Receiving "Not valid auth token and not registered token" when calling a webhook

Hello everyone :wave:

I am trying to perform a POST request on my custom Webhook, using Postman.

# 8base.yml

functions:
    testFn:
        type: webhook
        handler:
          code: src/webhooks/testFn/handler.js
        path: /testFn
        method: POST

β€’ If the request is sent without Authorization Bearer token, it works fine.

// This works fine πŸ‘Œ

curl --location --request POST 'https://api.8base.com/{workspace_id}/webhook/testFn' \
--header 'Content-Type: application/json' \
--data-raw '{
    "foo": "bar"
}'

β€’ However, when I perform the same action with any Authorization Bearer token in the header, it returns an error :frowning:

// This doesn't work ❌

curl --location --request POST 'https://api.8base.com/{workspace_id}/webhook/testFn' \
--header 'Authorization: Bearer 123' \
--header 'Content-Type: application/json' \
--data-raw '{
    "foo": "bar"
}'

// Error response

{
    "errors": [
        {
            "code": "InvalidTokenError",
            "message": "Token validation",
            "details": {
                "token": "Not valid auth token and not registered token",
                "reason": "Token validation"
            }
        }
    ]
}

This is a major issue, because all the third party APIs I’ll connect my workspace to send Authorization Bearer token in the headers.

Can someone help me solve this issue ?

Thanks

hey @andreas can you try using a valid ID token or API token instead of 123?

Hey @sebastian.scholl, I tried to use any possible ID token. :frowning:

Can you please confirm that you are using an 8base token?

Hey @sebastian.scholl , I just tried using the ID token of the current user, and it works. Thanks !

However, the following question is still present in my mind:

β€’ How am I going to manage webhooks that contain a Bearer Token in the headers? :thinking:

Thanks

1 Like