AppleSignIn(使用 Firebase 和 Expo)在本地工作但不能独立工作

Ali*_*hat 9 firebase react-native firebase-authentication expo apple-sign-in

我在我的 Expo 应用程序上实现了 signinWithApple 按钮,当我使用Firebase 身份验证选项卡中的host.exp.ExponentonServices ID进行 Apple 登录时,它在本地运行良好。

但是,当我创建一个独立的应用程序,和我一起TestFlight测试它,它不工作了我是否使用了host.exp.Exponent,什么都没有,或my specific app service IDServices ID

我在这里缺少什么?

我的代码:

handleApple = async () => {
    const csrf = Math.random().toString(36).substring(2, 15);
    const nonce = Math.random().toString(36).substring(2, 10);

    try {
      const appleCredential = await AppleAuthentication.signInAsync({
        requestedScopes: [
          AppleAuthentication.AppleAuthenticationScope.FULL_NAME,
          AppleAuthentication.AppleAuthenticationScope.EMAIL
        ],
        state: csrf,
        nonce: nonce
      });

      const {
        identityToken,

        fullName,
        email
      } = appleCredential;

      if (identityToken) {
        // login with credential
          const provider = new firebase.auth.OAuthProvider("apple.com");
          const credential = provider.credential({
            idToken: identityToken,
            rawNonce: nonce,

          });

          await firebase.auth().signInWithCredential(credential).then(user => {
          ...
Run Code Online (Sandbox Code Playgroud)

编辑 :

我设法通过在 firebase 的字段my bundle identifier上使用(这也是我的应用程序 ID)使其工作the Service ID

错误代码 :

错误:ID 令牌 [##.app-videos] 中的观众与预期的观众 ##.signin 不匹配。

但是现在在我的网站上使用 Apple 登录失败了。当我将 Service Id 字段更改为my specific app service ID(在Identifiers> 中找到Services IDs)时,我设法使其工作。

所以我坚持使用需要某些东西的应用程序和需要其他东西的网站。这是为什么?

当我重建我的应用程序时,我是否应该做一些特定的事情,以便将我对 mu 标识符所做的更改考虑在内?我正在使用这个,还不够吗?

expo build:ios --clear-provisioning-profile

小智 2

我遇到了同样的问题,应该通过以下方式解决。

GoogleService-info.plist您必须在 Firebase 控制台中使用与 Xcode 中的项目相同的 bundleId重新创建。

  • 使用 Expo 时您无权访问 Xcode。所以你的回答没有帮助。不管怎么说,还是要谢谢你。 (2认同)