-
I am testing out supabase auth, for performance reasons I would like to use the There is a, base64 encoded, HS256 secret available from their dashboard, but How should I import that secret? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
Strings make for a terrible secret format. Use a Uint8Array/Buffer as documented directly. |
Beta Was this translation helpful? Give feedback.
-
I just found the answer so I'll my own quesiton here. I am working in a deno environment but you may use the corresponding native API of your runtime. Supabase's secret is a simple HS256 buffer, which can be copied from their dashboard. It may looks like a base64 encoded string but it's not, so don't Convert the secret into a buffer and import { jwtVerify } from "jose";
const SUPABASE_JWT_SECRET = Deno.env.get("SUPABASE_JWT_SECRET");
const verifiedPayload = await jwtVerify(jwt, new TextEncoder().encode(SUPABASE_JWT_SECRET)); |
Beta Was this translation helpful? Give feedback.
I just found the answer so I'll my own quesiton here. I am working in a deno environment but you may use the corresponding native API of your runtime.
Supabase's secret is a simple HS256 buffer, which can be copied from their dashboard. It may looks like a base64 encoded string but it's not, so don't
atob()
it.Convert the secret into a buffer and
jose
will happily accept it.