世博谷歌登录在独立应用程序中失败

时间:2021-03-25 01:50:14

标签: javascript android react-native expo google-signin

我在我的 expo 应用程序中使用 expo-google-app-auth 进行登录。虽然它在 Expo Go 应用程序中运行良好,但在独立应用程序中,它没有提供从电子邮件中进行选择的选项。相反,它会引发此错误

{"code": "ERR_UNAVAILABLE", "line": 110, "column": 244, "sourceURL": "/data/user/0/appname/files/.expo-internal/bundle-*****"}

我已按照 expo 文档中的说明操作,并在我的 app.json 文件中添加了一个 android 独立客户端 ID、API 密钥和认证哈希。 我的注册功能

const signInWithGoogleAsync = async () => {
        try {
            const result = await Google.logInAsync({
                androidClientId: '************',
                androidStandaloneAppClientId : '**********',
                scopes: ['profile', 'email'],
            });
    
        if (result.type === 'success') {
            console.log('successful');
        } else {
            console.log('cancelled');
        }
        } catch (e) {
            console.log('Error gotten', e);
        }
    }

我的 app.json 文件

    "android": {
      "adaptiveIcon": {
        "foregroundImage": "./assets/adaptive-icon.png",
        "backgroundColor": "#FFFFFF"
      },
      "config": {
        "googleSignIn": {
          "apiKey": "****",
          "certificateHash": "*****************"
        }
      },
      "package": "package_name",
      "versionCode": 1,
      "enableDangerousExperimentalLeanBuilds": true
    },

0 个答案:

没有答案