The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
add guide for sign in with supabase
Kang Ming5fc9ed90b88d
diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.tsindex 6cdca4db441..7bc7cd9357f 100644--- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts+++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts@@ -1183,12 +1183,16 @@ export const integrations: NavMenuConstant = {items: [{ name: 'Overview', url: '/guides/integrations/integrations' },{- name: 'OAuth Apps',+ name: 'OAuth Apps (Beta)',url: undefined,items: [{- name: 'Building an OAuth App (Beta)',- url: '/guides/integrations/oauth-apps/building-an-oauth-app',+ name: 'Creating an OAuth App',+ url: '/guides/integrations/oauth-apps/creating-an-oauth-app',+ },+ {+ name: 'Authorizing an OAuth App',+ url: '/guides/integrations/oauth-apps/authorizing-an-oauth-app',},],},diff --git a/apps/docs/pages/guides/integrations/oauth-apps/authorizing-an-oauth-app.mdx b/apps/docs/pages/guides/integrations/oauth-apps/authorizing-an-oauth-app.mdxnew file mode 100644index 00000000000..a39ff679489--- /dev/null+++ b/apps/docs/pages/guides/integrations/oauth-apps/authorizing-an-oauth-app.mdx@@ -0,0 +1,43 @@+import Layout from '~/layouts/DefaultGuideLayout'++export const meta = {+ id: 'authorizing-an-oauth-app',+ title: 'Authorize an OAuth App (Beta)',+ description: 'Authorize an OAuth App',+}++## Overview++This guide steps through implementing **Sign-in with Supabase**. Once you've added OAuth2.0 support to your main application, you will receive an access and refresh token from your users that choose to **Sign in with Supabase** on your application.++The access token returned will grant your application full access to the [Management API](https://supabase.com/docs/reference/api/introduction) on behalf of the user.++## Implement the OAuth2.0 flow++Once you've register your OAuth App, you can use the OAuth2.0 protocol to seek consent from Supabase users to access their organization or project.++1. Call the [`GET /v1/oauth/authorize`](<https://api.supabase.com/api/v1#/oauth%20(beta)/authorize>) endpoint. This should redirect the user to a consent screen where they can select the organization that they want to grant access to.++ > Note: `redirect_uri` and `state` combined must not be larger than 4kB. PKCE is strongly recommended for security reasons.++2. Ensure that your application server has implemented the endpoint listed in the "Authorization callback URLs". After the user consents to your application receiving access, your application server will receive a `GET` request on the provided `redirect_uri` in the previous step. This `redirect_uri` will contain the following query parameters:++ `code` : A unique authorization code you can exchange for a Supabase access and refresh token.++ `state` : (Optional) The state you passed to the [`GET /v1/oauth/authorize`](<https://api.supabase.com/api/v1#/oauth%20(beta)/authorize>) endpoint previously.++3. Extract these query parameters and exchange the `code` using the [`POST /v1/oauth/token`](<https://api.supabase.com/api/v1#/oauth%20(beta)/token>) endpoint.++4. An access token and refresh token will be returned if the request is successful.++## Refresh an access token++You can use the [`POST /v1/oauth/token`](<https://api.supabase.com/api/v1#/oauth%20(beta)/token>) endpoint to refresh an access token using the refresh token returned at the end of the previous section.++## Access the Management API using the access token++Refer to [this section](http://localhost:3001/docs/reference/api/introduction#authentication) to learn more about authentication with the Management API.++export const Page = ({ children }) => <Layout meta={meta} children={children} />++export default Pagediff --git a/apps/docs/pages/guides/integrations/oauth-apps/building-an-oauth-app.mdx b/apps/docs/pages/guides/integrations/oauth-apps/creating-an-oauth-app.mdxsimilarity index 54%rename from apps/docs/pages/guides/integrations/oauth-apps/building-an-oauth-app.mdxrename to apps/docs/pages/guides/integrations/oauth-apps/creating-an-oauth-app.mdxindex 1b1863e2939..331814aec0b 100644--- a/apps/docs/pages/guides/integrations/oauth-apps/building-an-oauth-app.mdx+++ b/apps/docs/pages/guides/integrations/oauth-apps/creating-an-oauth-app.mdx@@ -1,15 +1,14 @@import Layout from '~/layouts/DefaultGuideLayout'export const meta = {- id: 'building-an-oauth-app',- title: 'Building an OAuth App (Beta)',- description: 'Building an OAuth App',+ id: 'creating-an-oauth-app',+ title: 'Create an OAuth App (Beta)',+ description: 'Create an OAuth App',}## Overview-This guide steps through implementing "Sign-in with Supabase". You can create and register an OAuth app under your organization. Once you've added OAuth2.0 support to your main application, you will receive an access and refresh token from the users that "Sign in with Supabase" through your application.-This access token returned will grant your application full access to the [Management API](https://supabase.com/docs/reference/api/introduction) on behalf of the user.+This guide steps through registering an OAuth app under your organization.## Creating an OAuth App