Webhook decoder not working
hello guys , i installed the npm package @kinde/webhooks to decode my JWT , in the docs it says to use
const decodedWebhook = decodeWebhook("eyJhbGc...");
if (decodedWebhook.type === WebhookEventType.userCreated) {
// decodedWebhook is type safe userCreated event
}
the problem is i'm getting this error Property 'type' does not exist on type 'Promise<WebhookEvent | null>
and i'm getting undefined result, in my console logs :
is the decoder not supported anymore and i should use an other one ?1 Reply
Hi Adam,
Thank you for reaching out.
The @kinde/webhooks package is still supported, but there are two issues in your implementation:
Missing await: The decodeWebhook function is asynchronous and returns a Promise
Missing domain parameter: The function requires a domain parameter for token validation
It should be const decoded = await decodeWebhook(jwt, "https://your-subdomain.kinde.com");
I think we need to update the Readme file.
Thank you again for bringing this to our attention.
Please let me know if you have any more questions.