We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 855ae07 commit a8ae658Copy full SHA for a8ae658
src/auth.ts
@@ -25,8 +25,10 @@ const config: NextAuthConfig = {
25
}
26
27
28
- const secret = process.env.SUPABASE_JWT_SECRET
29
- if (secret && token.id) {
+ const secretString = process.env.SUPABASE_JWT_SECRET
+ if (secretString && token.id) {
30
+ // Must strictly decode base64 into raw bytes for Supabase HS256!
31
+ const secretBuffer = Buffer.from(secretString, "base64")
32
token.supabaseAccessToken = jwt.sign(
33
{
34
aud: "authenticated",
@@ -35,7 +37,13 @@ const config: NextAuthConfig = {
35
37
email: token.email,
36
38
role: "authenticated",
39
},
- secret,
40
+ secretBuffer,
41
+ {
42
+ header: {
43
+ alg: "HS256",
44
+ kid: "7F438B89-1B14-4807-95B5-AAB76A6A0051",
45
+ },
46
47
)
48
49
return token
0 commit comments