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

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

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:

  1. [✓] Flutter (Channel stable, 3.10.1, on macOS 13.3.1 22E772610a darwin-arm64, locale en-IN)
  2. Flutter版本3.10.1,通道stable,位于/macOS 13.3.1 22E772610a darwin-arm64上,区域en-IN
  3. Flutter版本3.10.1,通道stable,位于/Users/USER_NAME/fvm/versions/3.10.1
  4. 上游存储库https://github.com/flutter/flutter.git
  5. 框架修订d3d8effc685天前),2023-05-16 17:59:05 -0700
  6. 引擎修订b4fb11214d
  7. Dart版本3.0.1
  8. DevTools版本2.23.1
  9. [✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
  10. Android SDK位于/Users/USER_NAME/Library/Android/sdk
  11. 平台android-33build-tools 32.1.0-rc1
  12. Java二进制文件位于:/Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
  13. Java版本OpenJDK Runtime Environmentbuild 11.0.15+0-b2043.56-8887301
  14. 所有Android许可证已接受。
  15. [✓] Xcode - develop for iOS and macOS (Xcode 14.3)
  16. Xcode位于/Applications/Xcode.app/Contents/Developer
  17. 构建14E222b
  18. CocoaPods版本1.11.3
  19. [✓] Chrome - develop for the web
  20. Chrome位于/Applications/Google Chrome.app/Contents/MacOS/Google Chrome
  21. [✓] Android Studio(版本2022.1
  22. Android Studio位于/Applications/Android Studio.app/Contents
  23. 可以从以下位置安装Flutter插件:
  24. 🔨https://plugins.jetbrains.com/plugin/9212-flutter
  25. 可以从以下位置安装Dart插件:
  26. 🔨https://plugins.jetbrains.com/plugin/6351-dart
  27. Java版本OpenJDK Runtime Environmentbuild 11.0.15+0-b2043.56-8887301
  28. [✓] VS Code(版本1.78.2
  29. VS Code位于/Applications/Visual Studio Code.app/Contents
  30. Flutter扩展版本3.64.0
  31. [✓] Connected device (3 available)
  32. sdk gphone64 arm64mobile emulator-5554 android-arm64 Android 12API 32)(emulator
  33. macOSdesktop macos darwin-arm64 macOS 13.3.1 22E772610a darwin-arm64
  34. Chromeweb chrome web-javascript Google Chrome 113.0.5672.126
  35. [✓] Network resources
  36. 所有预期的网络资源都可用。
  37. 未发现问题!
英文:

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:

  1. D/EGL_emulation(22226): app_time_stats: avg=3526.14ms min=22.24ms max=13948.25ms count=4
  2. W/System (22226): Ignoring header X-Firebase-Locale because its value was null.
  3. E/FirebaseAuth(22226): [GetAuthDomainTask] Error getting project config. Failed with INVALID_CERT_HASH 400
  4. 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 :

  1. [✓] Flutter (Channel stable, 3.10.1, on macOS 13.3.1 22E772610a darwin-arm64, locale en-IN)
  2. Flutter version 3.10.1 on channel stable at /Users/USER_NAME/fvm/versions/3.10.1
  3. Upstream repository https://github.com/flutter/flutter.git
  4. Framework revision d3d8effc68 (5 days ago), 2023-05-16 17:59:05 -0700
  5. Engine revision b4fb11214d
  6. Dart version 3.0.1
  7. DevTools version 2.23.1
  8. [✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
  9. Android SDK at /Users/USER_NAME/Library/Android/sdk
  10. Platform android-33, build-tools 32.1.0-rc1
  11. Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
  12. Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
  13. All Android licenses accepted.
  14. [✓] Xcode - develop for iOS and macOS (Xcode 14.3)
  15. Xcode at /Applications/Xcode.app/Contents/Developer
  16. Build 14E222b
  17. CocoaPods version 1.11.3
  18. [✓] Chrome - develop for the web
  19. Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
  20. [✓] Android Studio (version 2022.1)
  21. Android Studio at /Applications/Android Studio.app/Contents
  22. Flutter plugin can be installed from:
  23. 🔨 https://plugins.jetbrains.com/plugin/9212-flutter
  24. Dart plugin can be installed from:
  25. 🔨 https://plugins.jetbrains.com/plugin/6351-dart
  26. Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
  27. [✓] VS Code (version 1.78.2)
  28. VS Code at /Applications/Visual Studio Code.app/Contents
  29. Flutter extension version 3.64.0
  30. [✓] Connected device (3 available)
  31. sdk gphone64 arm64 (mobile) emulator-5554 android-arm64 Android 12 (API 32) (emulator)
  32. macOS (desktop) macos darwin-arm64 macOS 13.3.1 22E772610a darwin-arm64
  33. Chrome (web) chrome web-javascript Google Chrome 113.0.5672.126
  34. [✓] Network resources
  35. All expected network resources are available.
  36. 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:

确定