You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the getToken helper function from next-auth/jwt, setting raw: true should return the token without requiring the secret or salt. However, currently, the function throws an error asking for both secret and salt even when raw is set to true.
This seems unnecessary because when raw: true is used, the function should return the raw token directly without needing any decoding or verification, which usually requires the secret and salt.
What I’ve tried so far:
i attempted passing any dummy string to avoid throwing error it worked fine
How to reproduce
Import the getToken function from next-auth/jwt.
Use the following code to call getToken with raw: true:
Do not provide secret or salt in the configuration.
Observe the error requesting the secret and salt.
Expected behavior
When using raw: true, the getToken function should return the token as-is without requiring the secret or salt, since no verification or decoding should occur in this case. The current behavior of throwing an error requesting these fields is unexpected.
The text was updated successfully, but these errors were encountered:
alimorgaan
added
bug
Something isn't working
triage
Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
labels
Sep 22, 2024
Environment
Reproduction URL
https://github.com/alimorgaan/next-auth-getToken-raw-issue/
Describe the issue
In the
getToken
helper function fromnext-auth/jwt
, settingraw: true
should return the token without requiring thesecret
orsalt
. However, currently, the function throws an error asking for bothsecret
andsalt
even whenraw
is set totrue
.This seems unnecessary because when
raw: true
is used, the function should return the raw token directly without needing any decoding or verification, which usually requires thesecret
andsalt
.What I’ve tried so far:
How to reproduce
getToken
function fromnext-auth/jwt
.getToken
withraw: true
:secret
orsalt
in the configuration.secret
andsalt
.Expected behavior
When using
raw: true
, thegetToken
function should return the token as-is without requiring thesecret
orsalt
, since no verification or decoding should occur in this case. The current behavior of throwing an error requesting these fields is unexpected.The text was updated successfully, but these errors were encountered: