auth-js icon indicating copy to clipboard operation
auth-js copied to clipboard

Auth with Custom Token (Similar to Firebase)

Open johanneskares opened this issue 2 years ago • 0 comments

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?

johanneskares avatar Aug 31 '22 16:08 johanneskares