OAuth 2.1 Server Capabilities for Supabase Auth #38022
Replies: 34 comments 52 replies
|
Plugin solution for fast-mcp would be really awesome. |
|
The Supabase team is awesome! |
|
Really cool, we were about to start building this internally, so will be closely following! Out of curiosity, I believe Supabase uses their own auth internally as well. Furthermore there's currently a Supabase OAuth flow for the Integrations part, which is built closed-source. Is it intended to (ultimately) also move this part to the now to be created OAuth capabilities in Supabase Auth? Asking because it would show the ambition of this project, as well as showcase a potential use case already. |
|
So great to see this! Thanks heaps for listening to your community who requested this. It will be a game changer for creating applications that will also present an MCP endpoint. Please create a really good and in-depth tutorial or blog on how to use this. Also, documentation is key to help AI agents implement systems with Supabase. Please keep your documentation complete, detailed, and up to date, especially for something like this. |
|
Waiting for this as well, great to have it on the roadmap. I rolled my own API key-based authentication mechanism for https://githits.com in the meantime, but DCR would be a nice UX improvement, making it easier to publish and use the hosted MCP server. Will migrate as soon as this is out. |
|
Is there a opt-in or early access that I should be aware of? This is critical for users building MCP-first platforms. Excited to give feedback and push the limits |
|
Is there a place to opt-in the early access? |
|
Would really appreciate DCR for vihko.ai. Currently using user managed API keys instead. |
🚀 Beta Applications Now Open!Hey everyone! Thanks for all the enthusiasm and feedback! We're ready to start onboarding beta testers for Supabase OAuth 2.1 server capabilities. 📝 Apply for beta access: Click here🎮 Demo app: Click hereHow the beta works:We'll set up your project with:
You can also test it locally by using Coming soon:
|
|
Will there also be generic OIDC provider coming with this update? (see: https://github.com/orgs/supabase/discussions/6547) |
|
Is there a way for users to view and revoke authorized OAuth 2.1 clients? I'm looking at this from the MCP + DCR perspective. I think this should be part of the OAuth 2.1 server, as users need to see which apps they’ve authorized and revoke access if required. |
|
I applied for beta access and until I'm waiting to get approved it would be nice to be able to configure the oauth server locally to use my ngrok tunnel url. I think a lot of people will be using a tunnel to expose their local development environment to test if their service works with a third-party before deploying it. To do this we need to change the base url for the auth server locally. Right now /.well-known/oauth-authorization-server has the urls referencing localhost even when using a tunnel. Which is used for discovery by third-party services. Being able to change the base url via config.toml would be very beneficial to the development work flow. The other option is running the self-hosted supabase instance locally, but it's much more cybersome. |
|
This is awesome! This would make it much easier to support exposing our app's API with various scopes.
If the plan is to eventually support OIDC as part of this work on the roadmap, does this mean that you'll also be adding support for integrating our Supabase project with other IdP providers using OIDC? Right now for SSO with projects only SAML is supported. Some other aspects of SSO that I think could really use some love:
|
🚀 UPDATE: Public Beta is Now Live!OAuth Server support in Supabase Auth is now available in public beta. Docs: https://supabase.com/docs/guides/auth/oauth-server What this enablesYour Supabase project can now act as an OAuth/OIDC Provider, essentially a “Sign In with YourApp” identity provider for other apps, services, or integrations. Demo RepositoryTo help you get started quickly, I’ve published a small end-to-end example: 🔗 Demo repo: https://github.com/cemalkilic/supabase-auth-oauth2-demo The repo includes:
Feel free to explore it! Feedback Welcome 🙏Would love to hear from you:
Your feedback here will directly help shape the stable release. Thanks for trying it out! 🎉 |
|
Hi, thanks for working on this, I think it'll be a huge value add for customers! I'm testing out a connection between AWS and Supabase. I'm aiming to connect the OAuth server as an identity provider in AWS IAM so that Supabase JWTs can be used to authenticate with AWS services. When trying to authenticate against IAM using , I'm getting an error: "The amr claim is neither a string nor a list of strings". RFC is a bit ambiguous, would appreciate any guidance. |
|
Great update! I'm really looking forward to seeing how the balance between RLS and OAuth Scopes will be implemented. In my experience with ERP systems, granularity is key. I would vote for the OAuth-specific Access Token Hooks approach. This would allow mobile developers (especially in Flutter) to ensure that third-party apps only have the necessary access without compromising existing RLS policies in the database. |
|
Just a quick note... custom domains do not flow through to the /.well-known/oauth-authorization-server/auth/v1 endpoint. I'm not an OAuth expert but I'm noticing clients are having trouble discovering metadata if I use the custom domain as the host vs. the standard Supabase domain. Really excited to use this feature though and stop rolling my own OAuth and associated tables. |
|
A small update after using OAuth 2.1 on my product,
|
|
I also could not find a way to create a |
|
Hey, great work on this. I have a two-project setup where my core Supabase project is the identity provider and a separate website project uses anonymous auth for visitors. When users eventually sign up I want them to authenticate against the core project and then link that identity back to their anonymous user on the website project. The OAuth 2.1 server handles the provider side but the gap is that my website project can't consume a custom OIDC provider natively since Supabase Auth only supports specific social providers. I also need the website to be able to query the core project for things like billing info using the authenticated session, and ideally have sessions stay in sync across both projects. Is there any plan to support consuming another Supabase project as an OIDC provider, or to open up the third-party auth feature to arbitrary OIDC issuers beyond the current five? That would make multi-project setups like this much more straightforward. Thanks. |
|
We have set our SITE_URL to our backend api, because we want all auth requests to pass through our backend for various reasons, primarily because we have a multi-tenant APP with multiple frontends / subdomains, so there's no single SITE_URL. Hence we need backend to be in charge for redirects, etc. We can of course centralise oauth consent screen to a single domain, but using SITE_URL for that is limiting. Hence, it would be create to be able to customize it for the OAuth server rather than relying on the global SITE_URL. Otherwise things like |
|
Hello! I see that granular/custom scopes are on the roadmap. Any eta on this? Would love to start tinkering around with it. Thanks in advance and keep up the good work! |
|
I’ve been able to set up a Figma-style mobile OAuth flow using ASWebAuthenticationSession, and also use it for MCP auth with a Supabase OAuth server 🙌 I had two questions:
|
|
Hi @cemalkilic - thank you for developing this feature, we started using it.
Currently, function getScopeDisplayDetails(scope: string): ScopeDisplayDetails {
switch (scope) {
case "openid":
return {
description: "Verify your identity and sign you in with your A account.",
icon: byPrefixAndName.fal["shield-keyhole"],
};
case "profile":
return {
description: "View your basic profile information.",
icon: byPrefixAndName.fal["user"],
};
case "email":
return {
description: "View your email address.",
icon: byPrefixAndName.fal["envelope"],
};
default:
return {
description: `Access the ${scope} permission.`,
icon: byPrefixAndName.fal["circle-question"],
};
}
}But right now, I am at the mercy of Supabase.
So, what are the oauth logo limits? /**
* ...
* This method returns one of two response types:
* - `OAuthAuthorizationDetails`: User needs to consent - show consent page with client info
* - `OAuthRedirect`: User already consented - redirect immediately to the OAuth client
* ...
*/
getAuthorizationDetails(authorizationId: string): Promise<AuthOAuthAuthorizationDetailsResponse>This response flow doesn't make sense, I expected this to be handled at the browser that receives this response. Because I might need to show the
I have an app. I created a Discord server for my users to reach out to me by creating support tickets. The biggest friction was asking for the ticket creator's username, waiting, and then verifying. To improve the process, if the ticket creator hasn't linked their Discord to my app's username, my custom Discord App/Bot asks the ticket creator to log into my Discord App/Bot with my app (which then sets the user's Discord ID in that user's profile table). |
|
Hi,
For context, our intended setup is: a dedicated authorization server acting as the OAuth 2.1 provider, with our web and mobile applications as OAuth clients. We're not looking for granular scope management in Phase 1 — standard PKCE flows with client_id binding are sufficient for our use case. Thanks a lot! |
|
OIDC Discovery Issuer Mismatch When Using Custom Domains We're using the OAuth 2.1 server capabilities to enable SSO between two Supabase projects — one acts as the identity provider (IdP) and the other as the relying party (RP). This works perfectly when using the default Setup:
Repro steps:
Root cause: The OIDC discovery document at Workaround: Use the Expected behavior: The discovery document should return the custom domain as the issuer when accessed via a custom domain, so the issuer validation passes naturally. |
|
To add some context — the root cause is in response := OpenIDConfigurationResponse{
Issuer: config.JWT.Issuer,
AuthorizationEndpoint: issuer + "/oauth/authorize",
...
}The This also means all issued JWTs ( Since |
|
We are seeing the same need while evaluating Supabase OAuth 2.1 Server as a central OAuth/OIDC provider for multiple service apps. Spring Security OAuth2 Login / OIDC works for login, but the discovery document does not expose For now, we need an auth-frontend-managed logout endpoint that calls This seems aligned with the enterprise SSO / OIDC provider use case. Is RP-Initiated Logout planned for the OAuth 2.1 Server roadmap? |
|
Is there any plans or progress to support custom scopes per project? |


Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hey Supabase community! 👋
We're excited to share that we're adding OAuth 2.1 server capabilities to Supabase Auth, turning your Supabase project into a full OAuth authorization server. This means your project can act as an identity provider for third-party applications, similar to how you might use "Sign in with Google" today.
Current Status: Public Beta
Target Date:
What We're Building
We're implementing OAuth 2.1 authorization server capabilities that will allow your Supabase project to:
Exciting Use Cases
MCP (Model Context Protocol) Auth
Use your Supabase project as the auth provider for AI agents and LLM tools that support MCP.
"Login with Supabase Project"
Enable third-party applications to offer "Sign in with [Your App]" - turning your Supabase project into an identity provider like Google or GitHub.
Enterprise SSO (via OIDC - coming next)
Act as a single sign-on provider for your organization's internal tools.
API Access for Partner Integrations
Securely grant scoped access to your API for third-party developers and partners.
How It Works
Here's the authorization flow we're implementing:
sequenceDiagram participant User as End User participant Client as OAuth Client (Third Party) participant Frontend as Developer's Frontend App participant Auth as Supabase Auth Backend User->>Client: 1. Open app / click "Sign in <Supabase Project>" Client->>Auth: 2. GET /oauth/authorize?client_id=...&redirect_uri=... Auth->>Auth: 3. Create authorization record (no user yet) Auth->>Frontend: 4. HTTP 302 redirect with authorization_id Frontend->>User: 5. Show login/register page (if not authenticated) User->>Frontend: 6. Login/register Frontend->>Auth: 7. Authenticate user (pwd, social, MFA, etc.) Frontend->>Auth: 8. GET /oauth/authorizations/{authorization_id} (with auth) alt Auto-approve (existing consent) Auth->>Frontend: 9. Return JSON with redirect URL Frontend->>Client: 10. HTTP 302 redirect to client else Manual consent required Auth->>Frontend: 11. Return authorization details JSON Frontend->>User: 12. Show consent screen User->>Frontend: 13. Approve/deny consent Frontend->>Auth: 14. POST /oauth/authorizations/{authorization_id}/consent Auth->>Frontend: 15. Return redirect URL JSON Frontend->>Client: 16. HTTP 302 redirect to client endKey Design Decision: Flexible Authorization UI
Traditional OAuth servers host your application's UI. Instead, we're giving you complete control over the authorization and consent screens. After the initial
/authorizecall the user is taken to your app's frontend to be presented with the consent screen. This provides the freedom to build your app how you want, while Supabase Auth takes care of the protocol specifics:This gives you maximum flexibility to match your application's design and user experience.
What Supabase Provides
What You Need to Implement
Access Token Structure
Access tokens will be JWTs (like current Supabase tokens) with:
client_idclaim for OAuth client identificationroleclaim structure)Balancing RLS Power with OAuth Scopes
We want to preserve the power and flexibility of RLS policies while also enabling developers to "scope down" access tokens based on OAuth scopes. This is a challenging balance - RLS gives you fine-grained, row-level control, while OAuth scopes traditionally work at a higher level.
Our current thinking includes exploring these approaches:
Initial Limitations & Future Roadmap
Phase 1:
Phase 2:
We Need Your Feedback!
We'd love to hear your thoughts on:
1. Scope Management & Token Customization
Currently, we're starting without a scope system: OAuth tokens will work like regular session tokens with full user privileges. Authorization happens via RLS policies. We're exploring ways to "scope down" OAuth tokens while preserving RLS:
2. OpenID Connect Features
As we plan OIDC support, which features are most critical for you?
3. Dashboard UI for OAuth Client Management
What would you need in the dashboard?
4. Your Use Cases
What would you build with this? We're especially interested in:
Questions?
Drop your questions, feedback, and use cases below! We're actively working on this and your input will directly influence the implementation.
All reactions