👀 Our most exciting product launch yet 🚀 Join us May 8th for Sanity Connect

Issue with GROQ-powered webhook and missing authentication token in API call

7 replies
Last updated: Aug 10, 2023
I have created a GROQ-powered webhook, but when I publish a document to trigger it I get the error:
"hookId":"LBazGCoTp3zcMIp","isFailure":true,"failureReason":"other","resultCode":403,"resultBody":"{\"message\":\"Missing Authentication Token\"}"}
. Is this related to the API tokens on Sanity? It only happens on the production dataset.
Aug 9, 2023, 6:08 PM
Looks like you will need to pass in the API token in the API call :
--header 'Authorization: Bearer ${token}'
Can you check to see if you are doing so correctly?
Aug 10, 2023, 11:15 AM
I am not. What kind of token do I have to create?
Aug 10, 2023, 12:12 PM
I would recommend taking a look at this doc and follow the guidance there on how to get the token.
Aug 10, 2023, 12:18 PM
Thanks, I’ll try this. I’m confused why an auth token is only required when dealing with a production dataset (staging and dev didn’t require one). Do you know where I can see the settings for this?
Aug 10, 2023, 12:21 PM
Ah, I see it’s related to the dataset visibility.
Aug 10, 2023, 12:44 PM
Are you able to make the request work now with a token?
Aug 10, 2023, 2:05 PM
yes, it works as expected, thanks.
Aug 10, 2023, 2:06 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?