-
Notifications
You must be signed in to change notification settings - Fork 562
feat(oauth): add Supabase OAuth provider #2230
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?
Conversation
Pull Request Test Coverage Report for Build 19170193324Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
| Linkedin OAuthProviderConfiguration `json:"linkedin"` | ||
| LinkedinOIDC OAuthProviderConfiguration `json:"linkedin_oidc" envconfig:"LINKEDIN_OIDC"` | ||
| Spotify OAuthProviderConfiguration `json:"spotify"` | ||
| Supabase OAuthProviderConfiguration `json:"supabase"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if Supabase makes sense here. It can imply "supabase.com" which we do not support.
Maybe change this to "SupabaseAuth" or "AuthProject" something?
hf
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally LGTM except for the config name.
Summary
This PR adds support for using Supabase Auth as an OAuth 2.1 provider with full PKCE support, enabling Supabase Auth instances to federate authentication to other Supabase Auth instances. This implements the OAuth 2.1 capabilities discussed in https://github.com/orgs/supabase/discussions/38022.
What Changed
1. New Supabase OAuth Provider (
internal/api/provider/supabase.go)/userinfoendpointapp_metadataanduser_metadataas custom claims2. Generic PKCE Support for OAuth Providers
Added code to support dual PKCE flows:
Currently, only supabase auth requires PKCE but added the code to make it future proof as OAuth2.1 adoption is increasing. Added
RequiresPKCE()method (returns false by default) to all 25 existing providersFlow Matrix:
Configuration
Users can configure the Supabase provider via environment variables:
Technical Highlights
RequiresPKCE()interface method.oauth2.GenerateVerifier()- generates code verifieroauth2.S256ChallengeOption()- adds challenge to auth URLoauth2.VerifierOption()- adds verifier to token exchangeFlowState.CodeChallengeand verified against user's verifierFlowState.ProviderCodeVerifierand sent to provider during token exchangeManual Testing Scenarios: