Support multiple supabase backends #13150
Unanswered
alexcouper
asked this question in
Feature Requests
Replies: 1 comment
|
The workaround for this at the moment is to use the |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Context
I am using 2 separate supabase backends for different parts of an application. This provides a clear separation of data ownership and makes auditing access trivial. Each system has it's own auth providers - the user may have different email/passwords in each system - and the application is responsible for maintaining sessions with both backends, using the correct backend for different pieces of data.
Supabase mostly supports this, except for in the way that tokens are delivered and validated by the GoTrue client.
Tokens
During a login, supabase returns a token in the form
access_token=XXX;expires_in:Y;refresh_token:Z;token_type:bearer.This is stored by default in session storage under a key like
sb-<unique-subase-id>-auth-token.Having multiple supabase clients is possible, as each looks for its own session storage token and works correctly.
However, when logging in to supabase backend B, supabase backend A removes its token from storage.
I believe this is due to both backends actively detecting that
_isImplicitGrantFlow()is true, and then because A doesn't recognise B's token, the code in_initialize()deletes the session for A (even though this token was really for B):Here's the logic for
isImplicitGrantFlow():Is there a way that we could customize the parameters used in the grant flow such that each client would be able to know if it's relevant for it?
All reactions