Running a Flutter app with firebase_auth from a different machine in debug mode causes an Invalid_cert_Hash

huangapple go评论69阅读模式
英文:

Running a Flutter app with firebase_auth from a different machine in debug mode causes an Invalid_cert_Hash

问题

I used firebase_auth with github_sign_in provider to authenticate my users.
我使用了firebase_auth与github_sign_in提供程序来认证我的用户。

I have added the debug sha-1 and sha-256 keys to the firebase console.
我已将调试用的sha-1和sha-256密钥添加到Firebase控制台。

The app seems to be work on my local machine, however when i clone the repo to a new machine and add the same google-services.json file I am getting the following error:
该应用在我的本地机器上似乎工作正常,但是当我克隆到新的机器并添加相同的google-services.json文件时,我遇到以下错误:

Is this the intended behavior or am I making a mistake somewhere. Do I have to add debug sha-1 and sha-256 from every device in order for it to work without any issue?
这是预期的行为吗,还是我在某个地方犯了错误?我是否需要从每台设备添加调试用的sha-1和sha-256以使其无故障运行?

firebase auth package version used:
使用的firebase auth包版本:
4.6.1

flutter doctor -v:
flutter doctor -v:

[✓] Flutter (Channel stable, 3.10.1, on macOS 13.3.1 22E772610a darwin-arm64, locale en-IN)
    • Flutter版本3.10.1,通道stable,位于/macOS 13.3.1 22E772610a darwin-arm64上,区域en-IN
    • Flutter版本3.10.1,通道stable,位于/Users/USER_NAME/fvm/versions/3.10.1
    • 上游存储库https://github.com/flutter/flutter.git
    • 框架修订d3d8effc68(5天前),2023-05-16 17:59:05 -0700
    • 引擎修订b4fb11214d
    • Dart版本3.0.1
    • DevTools版本2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK位于/Users/USER_NAME/Library/Android/sdk
    • 平台android-33,build-tools 32.1.0-rc1
    • Java二进制文件位于:/Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java版本OpenJDK Runtime Environment(build 11.0.15+0-b2043.56-8887301)
    • 所有Android许可证已接受。

[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
    • Xcode位于/Applications/Xcode.app/Contents/Developer
    • 构建14E222b
    • CocoaPods版本1.11.3

[✓] Chrome - develop for the web
    • Chrome位于/Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio(版本2022.1)
    • Android Studio位于/Applications/Android Studio.app/Contents
    • 可以从以下位置安装Flutter插件:
      🔨https://plugins.jetbrains.com/plugin/9212-flutter
    • 可以从以下位置安装Dart插件:
      🔨https://plugins.jetbrains.com/plugin/6351-dart
    • Java版本OpenJDK Runtime Environment(build 11.0.15+0-b2043.56-8887301)

[✓] VS Code(版本1.78.2)
    • VS Code位于/Applications/Visual Studio Code.app/Contents
    • Flutter扩展版本3.64.0

[✓] Connected device (3 available)
    • sdk gphone64 arm64(mobile) • emulator-5554 • android-arm64  • Android 12(API 32)(emulator)
    • macOS(desktop)             • macos         • darwin-arm64   • macOS 13.3.1 22E772610a darwin-arm64
    • Chrome(web)                • chrome        • web-javascript • Google Chrome 113.0.5672.126

[✓] Network resources
    • 所有预期的网络资源都可用。

• 未发现问题!
英文:

I used firebase_auth with github_sign_in provider to authenticate my users. I have added the debug sha-1 and sha-256 keys to the firebase console. The app seems to be work on my local machine, however when i clone the repo to a new machine and add the same google-services.json file I am getting the following error:

D/EGL_emulation(22226): app_time_stats: avg=3526.14ms min=22.24ms max=13948.25ms count=4
W/System  (22226): Ignoring header X-Firebase-Locale because its value was null.
E/FirebaseAuth(22226): [GetAuthDomainTask] Error getting project config. Failed with INVALID_CERT_HASH 400
D/EGL_emulation(22226): app_time_stats: avg=104.52ms min=6.82ms max=4039.29ms count=47

Is this the intended behavior or am I making a mistake somewhere. Do I have to add debug sha-1 and sha-256 from every device in order for it to work without any issue ?

firebase auth package version used:
4.6.1

flutter doctor -v :

[✓] Flutter (Channel stable, 3.10.1, on macOS 13.3.1 22E772610a darwin-arm64, locale en-IN)
    • Flutter version 3.10.1 on channel stable at /Users/USER_NAME/fvm/versions/3.10.1
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision d3d8effc68 (5 days ago), 2023-05-16 17:59:05 -0700
    • Engine revision b4fb11214d
    • Dart version 3.0.1
    • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at /Users/USER_NAME/Library/Android/sdk
    • Platform android-33, build-tools 32.1.0-rc1
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E222b
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)

[✓] VS Code (version 1.78.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.64.0

[✓] Connected device (3 available)
    • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64  • Android 12 (API 32) (emulator)
    • macOS (desktop)             • macos         • darwin-arm64   • macOS 13.3.1 22E772610a darwin-arm64
    • Chrome (web)                • chrome        • web-javascript • Google Chrome 113.0.5672.126

[✓] Network resources
    • All expected network resources are available.

• No issues found!

答案1

得分: 0

需要为每台运行您的代码的机器添加新的SHA-1和SHA-256调试密钥。在添加新密钥后,请记得重新下载google-services.json文件,并替换项目中已有的文件。

英文:

You will need to add a new set of SHA-1 and SHA-256 Debug keys for each machine that you run your code on. Remember to re-download the google-services.json file after adding the new keys and replace the one already in your project

huangapple
  • 本文由 发表于 2023年5月22日 13:28:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/76303251.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定