~sircmpwn/sr.ht-discuss

3 2

temporary authentication failure on self-hosted instance

Details
Message ID
<87zfwogeen.fsf@the-brannons.com>
DKIM signature
permerror
Download raw message
So I'm trying to add a webhook to notify me when somebody makes a push
to a repo of mine.  As far as I can tell, I need to use the legacy API
to do that.  I couldn't figure a way to do it with the hut CLI for
instance.  I went and created a legacy oauth token, and then tried
sending my request to add a webhook:

```python
import requests
u = 'https://git.selfhosted.instance/api/~cmb/repos/my-cool-repo/webhooks'
headers = {'Authorization': 'token ' + a_32byte_hexstring}
requests.post(u, params=dict(
    url='https://the-brannons.com/cgi-bin/cmb-webhook?type=git',
    events='["repo:post-update"]'), headers=h)
```

And I consistently get a response with HTTP status code 500 and a JSON
payload of
{"errors": [{"reason": "Temporary authentication failure"}]}

I asked the instance admin, and he says he doesn't see anything in the
API logs.

Any help is appreciated.

-- Chris
Details
Message ID
<ZbiWT2JhsL1tiMKO@gpm.stappers.nl>
In-Reply-To
<87zfwogeen.fsf@the-brannons.com> (view parent)
DKIM signature
missing
Download raw message
On Mon, Jan 29, 2024 at 10:53:04AM -0800, Chris Brannon wrote:
> So I'm trying to add a webhook to notify me when somebody makes a push
> to a repo of mine.  As far as I can tell, I need to use the legacy API
> to do that.  I couldn't figure a way to do it with the hut CLI for
> instance.  I went and created a legacy oauth token, and then tried
> sending my request to add a webhook:
> 
> ```python
> import requests
> u = 'https://git.selfhosted.instance/api/~cmb/repos/my-cool-repo/webhooks'
> headers = {'Authorization': 'token ' + a_32byte_hexstring}

headers


> requests.post(u, params=dict(
>     url='https://the-brannons.com/cgi-bin/cmb-webhook?type=git',
>     events='["repo:post-update"]'), headers=h)

h


> ```
> 
> And I consistently get a response with HTTP status code 500 and a JSON
> payload of
> {"errors": [{"reason": "Temporary authentication failure"}]}
> 
> I asked the instance admin, and he says he doesn't see anything in the
> API logs.
> 
> Any help is appreciated.
> 

My stab at it

```python
import requests
u = 'https://git.selfhosted.instance/api/~cmb/repos/my-cool-repo/webhooks'
hdrs = {'Authorization': 'token ' + a_32byte_hexstring}
requests.post(u, params=dict(
     url='https://the-brannons.com/cgi-bin/cmb-webhook?type=git',
     events='["repo:post-update"]'), headers=hdrs)
```


Groeten
Geert Stappers
-- 
Silence is hard to parse
Details
Message ID
<87mssngwfv.fsf@the-brannons.com>
In-Reply-To
<ZbiWT2JhsL1tiMKO@gpm.stappers.nl> (view parent)
DKIM signature
permerror
Download raw message
Geert Stappers <stappers@stappers.nl> writes:

> On Mon, Jan 29, 2024 at 10:53:04AM -0800, Chris Brannon wrote:
>> So I'm trying to add a webhook to notify me when somebody makes a push
>> to a repo of mine.  As far as I can tell, I need to use the legacy API
>> to do that.  I couldn't figure a way to do it with the hut CLI for
>> instance.  I went and created a legacy oauth token, and then tried
>> sending my request to add a webhook:
>> 
>> ```python
>> import requests
>> u = 'https://git.selfhosted.instance/api/~cmb/repos/my-cool-repo/webhooks'
>> headers = {'Authorization': 'token ' + a_32byte_hexstring}
>
> headers
>
>
>> requests.post(u, params=dict(
>>     url='https://the-brannons.com/cgi-bin/cmb-webhook?type=git',
>>     events='["repo:post-update"]'), headers=h)
>
> h

That was just a typo caused by me transcribing into email the thing I'd
been typing at the Python interpreter.

Thanks,
-- Chris
Details
Message ID
<87fry0d5ut.fsf@the-brannons.com>
In-Reply-To
<ZbiWT2JhsL1tiMKO@gpm.stappers.nl> (view parent)
DKIM signature
permerror
Download raw message
Following back up on this because we did discover the cause of the
temporary failures.  Apparently one of the database indices was corrupt.
It was a simple fix.

-- Chris
Reply to thread Export thread (mbox)