Files
supabase/apps/docs/content/guides/integrations/build-a-supabase-oauth-integration/manage-oauth-app-access.mdx

91 lines
7.1 KiB
Plaintext

---
title: 'Manage OAuth app access'
subtitle: 'Control which OAuth apps can reach the projects in your organization'
description: 'See which OAuth apps your members have authorized and the projects each one covers, what Trusted Partner apps can do in your database, and how to revoke access.'
---
Review the OAuth apps authorized in your organization and revoke access you no longer want. Some apps let any member authorize them with that member's own permissions, so one app can have several grants in your organization.
## Authorization emails
When a member authorizes an app that uses member permissions, organization Owners and Administrators receive an email. The email names the app and the member. The app can access only what that member's role allows. If the app allows selecting projects and the member chose specific projects, the app can access only those projects. Otherwise, it can access all current and future projects in the organization.
To review or revoke the grant, follow the steps in [Review authorized apps](#review-authorized-apps).
## Review authorized apps
1. In your organization's settings, go to the **OAuth Apps** tab.
2. Under **Authorized apps**, find the app.
3. Open the app's **Manage app** menu and select **View access**.
Each grant shows the projects it covers, either all current and future projects or a list of specific projects. A grant tied to a member also shows that member. A grant that applies to the whole organization is labeled **Organization-wide** and doesn't show a member.
## Revoke an app for the organization
Revoking an app ends every grant for it in your organization, including grants created by individual members. Members lose access on the app's next request and must authorize the app again to reconnect. Only members with permission to revoke apps see the revoke option.
1. In your organization's settings, go to the **OAuth Apps** tab.
2. Under **Authorized apps**, find the app.
3. Open the app's **Manage app** menu and select **Revoke access**.
4. In the dialog, click **Revoke**.
Revoking an app with **Database token access** also closes its database connections. See [OAuth apps with database token access](#oauth-apps-with-database-token-access).
## Revoke your own grant
Any member can review and revoke the grants tied to them. This doesn't apply to organization-wide grants. To revoke one, an Owner or Administrator follows the steps in [Revoke an app for the organization](#revoke-an-app-for-the-organization).
1. Go to your account settings.
2. Open the **OAuth Apps** tab.
3. Under **Authorized apps**, find the app.
4. Open the app's **Manage app** menu and select **Revoke access**.
5. In the dialog, click **Revoke**.
The app can no longer access your projects in that organization. To reconnect, authorize the app again and reselect your projects. Other members' grants aren't affected.
## When a grant ends on its own
A grant tied to a member stays in place when the access it depends on goes away, and its access token remains valid. The grant loses access to the affected resources:
- If the member leaves the organization, the grant loses all access to the organization's resources.
- If an administrator lowers the member's role, the grant loses any access the new role doesn't cover.
- If an administrator removes a project from the member's project-scoped roles, the grant loses access to that project.
- If a project is transferred to another organization, the grant loses access to that project.
## OAuth apps with database token access
Some Trusted Partners connect to your Postgres database instead of going through the API. These apps show **Database token access** on the consent screen. When you authorize one, the partner gets its own Postgres role in each project it sets up. It connects as that role through [database token access](/docs/guides/platform/database-token-access) with its OAuth token as the password. Those connections can be direct or go through the shared pooler. You never share your database password.
<Admonition type="note">
Database token access for Trusted Partners is in private alpha. Only partners Supabase approves can ask for database token access.
</Admonition>
### What the partner can access
The partner's app sets one of two access levels, which you can't lower.
| Access level | What the partner can do |
| -------------- | -------------------------------------------------------------------------------------------- |
| Read only | Read every table in every schema, including the `auth` and `storage` schemas. |
| Read and write | Everything the `postgres` role can do, including changing data and creating tables and jobs. |
Both levels bypass Row Level Security. Both can also see your schema, table, and role names along with the queries other connections are running.
By default, the authorization covers every project in your organization now and every project you create later. Because database token access works with [scoped access for OAuth apps](/docs/guides/integrations/build-a-supabase-oauth-integration/scoped-access#project-selection), a partner can turn on project selection for its app. The consent screen then asks you to choose all current and future projects or up to 10 specific projects. When you select specific projects, the partner can connect only to those projects.
### What changes on your project
Each project needs Postgres 17.6.1.081 or later and must be active and healthy. The consent screen lists any project that needs changes. You can authorize the partner only after you fix them. If you selected specific projects, you can remove a listed project from your selection instead.
Before it connects to a project, the partner runs a setup step. Setup creates the partner's role and turns on database token access and [SSL enforcement](/docs/guides/platform/ssl-enforcement) if they're off. Turning on either setting makes connections through the shared pooler close and reconnect. Turning on SSL enforcement also closes connections that don't use SSL. Check that your own apps connect with SSL before you authorize a partner.
### See and revoke partner access
Under **Authorized apps**, the app shows a **Database token access** tag with its access level. Its open connections appear in `pg_stat_activity` under its role name. On Team and Enterprise plans, the [audit log](/docs/guides/security/platform-audit-logs) records each connection it opens.
To end its access, [revoke the app for the organization](#revoke-an-app-for-the-organization). Supabase refuses the partner's new connections right away. It then turns off login for the partner's role and closes the partner's open connections on each project and its read replicas.
The role stays in your database with login turned off. Anything the partner created, such as tables, functions, triggers, `pg_cron` jobs, or replication slots, also stays and keeps running. Ask the partner for the list of what its integration creates and how to remove it. Database token access and SSL enforcement stay on until you turn them off in [Database Settings](/dashboard/project/_/database/settings).