-
Notifications
You must be signed in to change notification settings - Fork 594
feat: add Supabase Auth identifier to OAuth redirect URLs #2299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat: add Supabase Auth identifier to OAuth redirect URLs #2299
Conversation
Pull Request Test Coverage Report for Build 20816155494Details
💛 - Coveralls |
|
Interesting use case. I guess it is uncommon for the same URL to be used as the redirect URL for multiple auth servers in different OAuth flows, which is why this isn’t really described in the spec? |
|
@cemalkilic the security bot on the supabase-js repo has some interesting takes: I think, the way we have talked about it, is that the sb parameter is for disambiguation. Users requiring extra protection should use |
@bnjmnt4n, yeah most likely. This change is to support external OAuth integrations where the redirect doesn’t come from Supabase Auth, and to ensure the Supabase SDK doesn’t handle flows it didn’t initiate. @mandarini exactly, PKCE covers those cases. |
…redirects-auth-919
…redirects-auth-919
Summary
Adds a Supabase Auth identifier (
sb) to URL fragments in all OAuth redirect responses to help clients distinguish Supabase Auth redirects from third-party OAuth flows.Problem
auth-js GoTrueClient currently intercepts all URL fragments containing
access_token, including those from non-Supabase OAuth providers. This causes unintended logouts and authentication issues when users have other OAuth flows in their applications.Related issue: supabase/supabase-js#1697
Solution
Added an empty
sbparameter to the URL fragment in all redirect responses:AsRedirectURL)__isAuthError, but adding it for error to be fault-tolerant, and non-supabase-sdk cases)Example redirect URL:
https://example.com/callback#access_token=xxx&refresh_token=yyy&expires_in=3600&sbClients can now check for the presence of
sbin the fragment to confirm the redirect originated from Supabase Auth.