We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thanks for the tutorial.
I'm getting verification failures, however. The problem is that you're never using the same key. First you generate a JWT with:
//authenticate a user const payload = { id: user._id, name: username }; const jwt = await create({ alg: "HS512", typ: "JWT" }, { payload }, key);
The key value above is created on the fly by this, in apiKey.ts:
key
export const key = await crypto.subtle.generateKey( { name: "HMAC", hash: "SHA-512" }, true, ["sign", "verify"], );
But later, when you try to verify the JWT from an incoming query, you create a whole new key and use it:
//authenticate a user const payload = { id: user._id, name: username }; const jwt = await create({ alg: "HS512", typ: "JWT" }, { payload }, key); <-- key is generated again in apiKey.ts.
So you're encoding with one key and trying to decode with another. This always fails.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Thanks for the tutorial.
I'm getting verification failures, however. The problem is that you're never using the same key. First you generate a JWT with:
The
key
value above is created on the fly by this, in apiKey.ts:But later, when you try to verify the JWT from an incoming query, you create a whole new key and use it:
So you're encoding with one key and trying to decode with another. This always fails.
The text was updated successfully, but these errors were encountered: