9

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

host.exp.Exponent但是,当我创建一个独立的应用程序并使用 TestFlight 对其进行测试时,无论我使用、nothing 还是my specific app service IDon ,它都不再起作用Services 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 => {
          ...

编辑 :

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

错误代码 :

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

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

所以我被一个需要一些东西的应用程序和一个需要另一个东西的网站所困。这是为什么?

当我重建我的应用程序时,我是否应该做一些具体的事情,以便考虑到我对 mu 标识符所做的更改?我用这个,还不够吗?

expo build:ios --clear-provisioning-profile

4

1 回答 1

2

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

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

于 2020-08-24T23:55:01.203 回答