gpt4 book ai didi

javascript - Expo Google 登录 DEVELOPER_ERROR

转载 作者:行者123 更新时间:2023-12-04 01:40:44 30 4
gpt4 key购买 nike

我开发了一个 React Native 应用程序,我使用 Expo Google-Sign-In 进行 Firebase 身份验证。当我尝试对 Android 上的独立 APK 进行身份验证时收到错误“DEVELOPER_ERROR”。

最初,我使用的是“Expo Google”,但那是
现在已弃用,我的登录按钮在我的独立 APK 上没有执行任何操作。使用Expo Google 方法,我发现必须设置androidStandaloneAppClientId。即使在那之后,登录在身份验证后也卡在了谷歌主页上。我尝试了使用自定义重定向 URI 的解决方案,如

重定向网址:${AppAuth.OAuthRedirect}:/oauth2redirect/google
但这导致了另一个错误:redirect_uri 不匹配。

我改为使用 Expo Google-Sign-In 库,每次尝试进行身份验证时都会给我一个 DEVELOPER_ERROR。

在那之后,我尝试过:

  • 下载 google-services.json 并在我的应用程序中使用它
  • 在 google-services.json 和 Firebase 中设置 SHA1 指纹
  • 将我的 app.json 中的 android.configuration.certificate 哈希中的 certificateHash 设置为我的 SHA1 指纹。
  • 检查并确保正确设置包名称

  • 我尝试了在 Expo Google-Sign-In 中涉及 DEVELOPER_ERROR 的现有线程中可能没有提到的任何其他内容。

    我在下面的代码中提到的变量来自以下内容:

    SHA1 已生成并用于创建我的凭证,并且是在我的 OAuth Android 客户端 ID 中使用的指纹。

    我在整个文件中引用的客户端 ID 是我的 OAuth Web 客户端 ID 的 ID。但是,我也尝试使用 Android 并且没有任何改变。

    api_key 中的“CurrentKey”是我的 Firebase 项目中的 API key 。

    这是我的 Google 凭据页面的链接。

    https://imgur.com/a/u8cPxQl

    /* 我的 app.json: */
    {
    "expo": {
    "name": "AssistiveNote",
    "privacy": "public",
    "description": "A note app for people who have trouble reading text.",
    "slug": "assistivenote",

    "sdkVersion": "33.0.0",
    "version": "2.0.0",
    "orientation": "portrait",
    "icon": "./screens/images/icon.png",


    "ios": {
    "bundleIdentifier": "com.danyalbabar.assistivenote"
    },

    "android": {
    "versionCode": 2,
    "package": "com.danyalbabar.assistivenote",
    "googleServicesFile": "./google-services.json",
    "permissions": [ " " ],
    "config": {
    "googleSignIn": {
    "certificateHash": "XXXX"
    }
    }
    }

    }
    }

    我的 google-services.json:
      {
    "project_info": {
    "project_number": "XXXX",
    "firebase_url": "https://era-gvision.firebaseio.com",
    "project_id": "era-gvision",
    "storage_bucket": "era-gvision.appspot.com"
    },
    "client": [
    {
    "client_info": {
    "mobilesdk_app_id": "XXXX",
    "android_client_info": {
    "package_name": "com.danyalbabar.assistivenote"
    }
    },
    "oauth_client": [
    {
    "client_id": "XXXX",
    "client_type": 3
    }
    ],
    "api_key": [
    {
    "current_key": "XXXX"
    }
    ],
    "services": {
    "appinvite_service": {
    "other_platform_oauth_client": [
    {
    "client_id": "XXXX",
    "client_type": 3
    }
    ]
    }
    }
    }
    ],
    "configuration_version": "1"
    }

    最佳答案

    这是配置不匹配。确保您的 android/app/google-services.json 是正确的。

    您可能需要将 SHA 证书指纹添加到 Firebase 配置中。按照以下帖子中的说明查找您的 SHA1 指纹:SHA-1 fingerprint of keystore certificate .然后,转到 https://console.firebase.google.com/ ,选择你的应用,在项目设置(左上 Angular 的齿轮图标)->你的应用->SHA证书指纹下添加SHA1值

    如果您将配置对象中的 webClientId 传递给 GoogleSignin.configure(),请确保它是正确的。您可以从 Google Developer Console 获取您的 webClientId .它们列在“OAuth 2.0 客户端 ID”下。

    如果您在 Debug模式下运行您的应用程序而不使用 webClientId 或者您确定它是正确的,则问题可能是签名(SHA-1 或 SHA-256)不匹配。您需要将以下内容添加到 android/app/build.gradle:

    signingConfigs {
    debug {
    storeFile file(MYAPP_RELEASE_STORE_FILE)
    storePassword MYAPP_RELEASE_STORE_PASSWORD
    keyAlias MYAPP_RELEASE_KEY_ALIAS
    keyPassword MYAPP_RELEASE_KEY_PASSWORD
    }
    release {
    ...
    }

    关于javascript - Expo Google 登录 DEVELOPER_ERROR,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57505545/

    30 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com