Dam*_*ast 2 firebase firebase-authentication flutter flutter-web
根据文档,localhost应该与所有端口一起列入白名单:https://support.google.com/firebase/answer/6400741 ?authuser=0 - 我在控制台和firebase中检查了这一点,并且localhost实际上已列入白名单。
但是当我尝试在 Flutter web 中执行以下操作时,出现未列入白名单的错误:
final GoogleSignIn _googleSignIn;
final googleUser = await _googleSignIn.signIn(); // This is where the error happens
Run Code Online (Sandbox Code Playgroud)
Error: PlatformException(idpiframe_initialization_failed, Not a valid origin for the client: http://localhost:59386 has not been whitelisted for client ID XXXXXX.apps.googleusercontent.com. Please go to https://console.developers.google.com/ and whitelist this origin for your project's client ID., https://developers.google.com/identity/sign-in/web/reference#error_codes, null)
at Object.createErrorWithStack (http://localhost:59386/dart_sdk.js:4353:12)
at Object._rethrow (http://localhost:59386/dart_sdk.js:37968:16)
at async._AsyncCallbackEntry.new.callback (http://localhost:59386/dart_sdk.js:37962:13)
at Object._microtaskLoop (http://localhost:59386/dart_sdk.js:37794:13)
at _startMicrotaskLoop (http://localhost:59386/dart_sdk.js:37800:13)
at http://localhost:59386/dart_sdk.js:33309:9
Run Code Online (Sandbox Code Playgroud)
我使用这些 dart 依赖项:
cloud_firestore: ^0.14.2
firebase_auth: ^0.18.3+1
google_sign_in: ^4.5.6
Run Code Online (Sandbox Code Playgroud)
我正在使用https://www.gstatic.com/firebasejs/8.1.1/firebase-auth.js- 所以这应该都是最新的。
因此,尽管文档声称所有端口都已列入白名单,但事实并非如此。
在端口 5000 上运行 Flutter(已在https://console.developers.google.com/中预先填写,但在https://console.firebase.google.com/中未提及) ,应用程序按预期工作。
要让 IntelliJ 在特定端口上运行 Flutter,请编辑运行配置并添加--web-port 5000其他参数:
| 归档时间: |
|
| 查看次数: |
1186 次 |
| 最近记录: |