使用 Okta 设置单点登录
此功能仅在团队和企业计划中可用。如果你是现有的团队或企业计划客户,请继续下面的设置。
🌐 This feature is only available on the Team and Enterprise Plans. If you are an existing Team or Enterprise Plan customer, continue with the setup below.
想找关于如何在你的 Supabase 项目中添加单点登录支持的文档吗?快去看看 项目的 SAML 2.0 单点登录 吧。
🌐 Looking for docs on how to add Single Sign-On support in your Supabase project? Head on over to Single Sign-On with SAML 2.0 for Projects.
Supabase 支持使用 Okta 进行单点登录(SSO)。
🌐 Supabase supports single sign-on (SSO) using Okta.
第1步:在应用仪表板中选择创建应用集成 #
🌐 Step 1: Choose to create an app integration in the applications dashboard [#create-app-integration]
导航到 Okta 管理控制台的应用仪表板。点击 创建应用集成。
🌐 Navigate to the Applications dashboard of the Okta admin console. Click Create App Integration.

步骤 2:在应用集成对话框中选择 SAML 2.0 #
🌐 Step 2: Choose SAML 2.0 in the app integration dialog [#create-saml-app]
Supabase 支持 SAML 2.0 SSO 协议。在“创建新的应用集成”对话框中选择它。
🌐 Supabase supports the SAML 2.0 SSO protocol. Choose it from the Create a new app integration dialog.

步骤 3:填写常规设置 #
🌐 Step 3: Fill out general settings [#add-general-settings]
你在这里输入的信息用于查看你的 Okta 应用菜单。你可以选择任何喜欢的值。‘Supabase’ 作为名称适用于大多数使用场景。
🌐 The information you enter here is for visibility into your Okta applications menu. You can choose any values you like. Supabase as a name works well for most use cases.

第4步:填写 SAML 设置 #
🌐 Step 4: Fill out SAML settings [#add-saml-settings]
这些设置让 Supabase 能够正确使用 SAML 2.0 与你的 Okta 应用。确保你按照表格中显示的完全一样输入这些信息。
🌐 These settings let Supabase use SAML 2.0 properly with your Okta application. Make sure you enter this information exactly as shown on in this table.
| 设置 | 数值 |
|---|---|
| 单点登录 URL | https://alt.supabase.io/auth/v1/sso/saml/acs |
| 将此用于接收者 URL 和目标 URL | ✔️ |
| 受众 URI(SP 实体 ID) | https://alt.supabase.io/auth/v1/sso/saml/metadata |
默认 RelayState | https://supabase.nodejs.cn/dashboard |
| 名称 ID 格式 | EmailAddress |
| 应用用户名 | 邮箱 |
| 更新应用用户名于 | 创建和更新 |

第5步:填写属性声明 #
🌐 Step 5: Fill out attribute statements [#add-attribute-statements]
属性声明允许 Supabase 在每次登录时获取有关你的 Okta 用户的信息。
🌐 Attribute Statements allow Supabase to get information about your Okta users on each sign-in.
需要一个 email 到 user.email 的声明。 下面显示的其他映射是可选的,并且可以根据你的 Okta 设置进行配置。如果不确定,请复制所示的相同配置。稍后你将在步骤 10中使用此映射。

步骤6:获取 IdP 元数据 URL #
🌐 Step 6: Obtain IdP metadata URL [#idp-metadata-url]
Supabase 需要完成与你的 Okta 应用的单点登录启用。
🌐 Supabase needs to finalize enabling single sign-on with your Okta application.
要执行此操作,请向下滚动到 Supabase 应用的 Sign On 选项卡中的 SAML Signing Certificates 部分。选择状态为 Active 的 SHA-2 行。点击 Actions 下拉按钮,然后点击 View IdP Metadata。
🌐 To do this scroll down to the SAML Signing Certificates section on the Sign On tab of the Supabase application. Pick the SHA-2 row with an Active status. Click on the Actions dropdown button and then on the View IdP Metadata.
这将会在浏览器的新标签页中打开 SAML 2.0 元数据 XML 文件。稍后你需要在步骤 9中输入这个 URL。
🌐 This will open up the SAML 2.0 Metadata XML file in a new tab in your browser. You will need to enter this URL later in Step 9.
链接通常是这个结构:https://<okta-org>.okta.com/apps/<app-id>/sso/saml/metadata

步骤7:在仪表板中启用单点登录 #
🌐 Step 7: Enable SSO in the Dashboard [#dashboard-enable-sso]
- 访问组织设置页面下的SSO标签。

- 切换 启用单点登录 以开始配置。启用后,配置表单将会出现。

步骤 8:配置域名 #
🌐 Step 8: Configure domains [#dashboard-configure-domain]
输入一个或多个与你用户邮箱地址相关的域名(例如,supabase.com)。这些域名决定哪些用户可以通过SSO登录。
🌐 Enter one or more domains associated with your users email addresses (e.g., supabase.com).
These domains determine which users are eligible to sign in via SSO.

如果你的组织使用多个电子邮件域名——例如,员工用 supabase.com,承包商用 supabase.io——你可以在这里添加多个域名。所有列出的域名都可以用于 SSO 登录。
🌐 If your organization uses more than one email domain - for example, supabase.com for staff and supabase.io for contractors - you can add multiple domains here. All listed domains will be authorized for SSO sign-in.

我们不允许使用像 gmail.com、yahoo.com 这样的公共域名。
🌐 We do not permit use of public domains like gmail.com, yahoo.com.
每个 SSO 提供商都可以配置不同的邮箱域名。对于多环境设置(开发/预演/生产),我们建议使用 IdP 发起的流程,在同一域名下使用多个 SAML 应用,而不是基于域名的路由。更多详情,请参阅 多个 SSO 提供商指南。
🌐 Each SSO provider can be configured with different email domains. For multi-environment setups (Dev/Staging/Prod), we recommend using IdP-initiated flow with multiple SAML apps under the same domain rather than domain-based routing. For more details, see the Multiple SSO Providers guide.
第9步:配置元数据 #
🌐 Step 9: Configure metadata [#dashboard-configure-metadata]
在“元数据 URL”字段中输入你从 步骤 6 获取的元数据 URL:
🌐 Enter the metadata URL you obtained from Step 6 into the Metadata URL field:

第10步:配置属性映射 #
🌐 Step 10: Configure attribute mapping [#dashboard-configure-attributes]
把你在步骤5填写的 SAML 属性输入到属性映射部分。
🌐 Enter the SAML attributes you filled out in Step 5 into the Attribute Mapping section.

如果你没有自定义设置,可以通过点击 Okta 预设来节省一些时间。
🌐 If you did not customize your settings you may save some time by clicking the Okta preset.
第11步:注册时加入组织(可选)#
🌐 Step 11: Join organization on signup (optional) [#dashboard-configure-autojoin]
**推荐的工作流程:**一开始先关闭自动加入,以测试你的 SSO 配置。一旦 SSO 登录正常工作,如果需要,可以开启自动加入。
默认情况下,这个设置是关闭的,通过 SSO 登录的用户不会自动被添加到你的组织中。
🌐 By default this setting is disabled, users signing in via SSO will not be added to your organization automatically.

如果你希望通过SSO登录的用户 在登录时自动加入你的组织,请开启此选项。自动加入适用于 每次登录,不仅仅是第一次注册——这让你在启用此功能前测试SSO也很安全。
🌐 Toggle this on if you want SSO-authenticated users to be automatically added to your organization when they sign in via SSO. Auto-join applies on every sign-in, not only on first signup - this makes it safe to test SSO before enabling this feature.

开启自动加入后,你可以为新用户选择默认角色:
🌐 When auto-join is enabled, you can choose the default role for new users:

我们建议将 开发者 作为默认角色(最小权限原则),并根据需要单独提升用户权限。
🌐 We recommend choosing Developer as the default role (principle of least privilege) and promoting users individually as needed.
访问 access-control 文档,了解每个角色的详细信息。
🌐 Visit access-control documentation for details about each role.
步骤12:保存更改 #
🌐 Step 12: Save changes [#dashboard-configure-save]
当你点击 保存更改 时,你的新 SSO 配置会立即生效。从那一刻起,任何使用与你配置的域名匹配的邮箱地址的用户访问你们组织的登录网址时,都会通过 SSO 流程进行。
🌐 When you click Save changes, your new SSO configuration is applied immediately. From that moment, any user with an email address matching one of your configured domains who visits your organization's sign-in URL will be routed through the SSO flow.
下一步:测试你的 SSO 配置
在向你的组织推出单点登录(SSO)之前,我们强烈建议进行彻底测试。请查阅我们的 SSO 测试和最佳实践 指南,了解更多信息:
🌐 Before rolling out SSO to your organization, we strongly recommend thorough testing. Visit our SSO Testing and Best Practices guide for:
- 逐步测试说明
- 如何确认自动加入功能正常工作
- 常见问题与解决方法
- 安全最佳实践
- 预发布清单
在 Okta 沙箱环境中测试: 如果你的组织有 Okta 沙箱环境,建议先在那儿测试你的 SSO 配置,再应用到生产环境。