How do I decode a JWT string using the decode
function from next-auth/jwt
?
#12527
Unanswered
chrisidakwo
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The
next-auth/jwt
decode function throws the error no matching decryption secret, even when all the right properties have been provided that I'm not sure how else to decode the token.BACKGROUND:
I have a setup where I'm using
jwt
session strategy with the credentials provider to authenticate users. However, I want 3rd-party applications to be able to make authenticated API requests to my application using Bearer token. This is what the relevant parts of my auth config looks like:Now, I have a function that wraps API endpoints requiring bearer authentication:
For some reason, the awaited decode call throws the error "no matching decryption secret" which I find strange because it's the same set of values the
getToken()
method uses internally to successfully decode a token. See line 185 in the screenshot.Does anyone have an idea how to use the decode function?
Beta Was this translation helpful? Give feedback.
All reactions