Skip to content

Please help me with Next authentication issue #4

Answered by venuswhispers
DavidLamos asked this question in Q&A
Discussion options

You must be logged in to vote

The solution i have found is to sign the JWT with an asymmetric key and then share the PUBLIC KEY with the other APIS this way I can verify the information was signed by my server ( jwt issuer which holds the private key ).

There is a need to override the encode / decode methods for JWT on next-auth in order to use RS256 instead of the default algorithm.

From that point I would be able to send the encrypted JWT token to another HTTP API ( via HTTP HEADER ) and verify it on the HTTP API which will only need to know the PUBLIC KEY in order to verify the signature ( the private key never leaves my jwt issuing environment ) thus being able to verify the signature even if offline ( i.e. no ext…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@DavidLamos
Comment options

Answer selected by DavidLamos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants