auth-js
auth-js copied to clipboard
Auth with Custom Token (Similar to Firebase)
Feature request
Is your feature request related to a problem? Please describe.
I'm thinking of transitioning from Firebase to Supabase. I'm using a custom Auth flow with Firebase, to use a Web3 wallet like Metamask to verify the user. This is not possible in Supabase. In Firebase I can do
const customToken = getAuth().createCustomToken(user-uid)
in the backend, after verifying a Metamask Signature. And then in the frontend call:
signInWithCustomToken(getAuth(), customToken)
to Sign into Firebase Auth. I've seen a similar approach using Supabase in this video. But it seems hacky since it's using setAuth()
on the front-end and that seems meant for serverside access. It also doesn't persist the login state between browser sessions.
Describe the solution you'd like
Ideally, I could create a signed JWT in the backend from the JWT secret, send it to the frontend and use it to login, while goetrue-js handles all the session management. Is this already possible?