首页 > 解决方案 > Firebase Web 客户端和 OIDC 提供程序问题

问题描述

我在 Google Identity Platform 控制台中配置了一个 OIDC 提供程序(链接到 Keycloak OIDC 提供程序)。这是我的单页应用程序中的代码:

provider = new firebase.auth.OAuthProvider('oidc.keycloak');
firebaseAuth.auth.signInWithPopup(provider)
      .then(value => {
        log.info(`It worked!`, value);
      })
      .catch(err => {
        log.info('Something went wrong:', err);
      });

弹出窗口出现,我可以登录到 Keycloak,但是在弹出窗口消失后,浏览器中会抛出以下错误:

{code: "auth/admin-restricted-operation", message: "This operation is restricted to administrators only."}

我正在使用最新版本的 Firebase 客户端 SDK 和 AngularFire2,并且我已经成功配置了电子邮件/密码身份验证。在 Google 身份平台中,我有:

发行人(网址):

https://auth.example.com/auth/realms/myrealm

和回调网址:

https://myapp-12345.firebaseapp.com/__/auth/handler

我需要在客户端进行其他配置吗?问题可能出在 OIDC 提供程序 (Keycloak) 及其配置上吗?

标签: javascriptfirebasefirebase-authenticationgoogle-identity-toolkit

解决方案


您似乎在 Google Cloud Identity Platform 设置(在 Google Cloud Console 中)中禁用了客户端 SDK 的用户注册。这是在Settings下面的部分User actionsEnable create (sign-up)应选中该复选框。


推荐阅读