-
Notifications
You must be signed in to change notification settings - Fork 538
Open
Labels
auth-jsRelated to the auth-js library.Related to the auth-js library.bugSomething isn't workingSomething isn't working
Description
Bug report
- I confirm this is a bug with Supabase, not with my own application.
- I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
Leveraging supabase-js and Auth Hooks configured in the Supabase dashboard, the results are inconsistent. When retrieving a session with supabase.auth.getSession() the session.user does not line up with the JWT inside session.access_token. (For reference, the auth.users table is not populated with any raw_user_metadata.)
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
- Supabase Dashboard: Auth Hook is configured to add to
user_metadataclaim.
Client Side:
- On the client side, retrieve the session with
supabase.auth.getSession()returning asessionobject. session.access_tokenJWT contains modifieduser_metadata. (Validated by decodingsession.access_token)session.userhas overlap with the token on a few attributes, but most notable theuser_metadataandapp_metadataare from the backend, instead of extracted from the token.
Expected behavior
Ideally outcome would be that session.user contains the merge of the user data received from the backend, as well as the decoded access_token.
System information
- Version of supabase-js: 2.39.3
- Version of Node.js: 20
Additional context
This might possibly be an issue with the gotrue project, where the backend API should return the additional claims developed in the auth hook to the client.
bombillazo and bipin0x01
Metadata
Metadata
Assignees
Labels
auth-jsRelated to the auth-js library.Related to the auth-js library.bugSomething isn't workingSomething isn't working