我正在嘗試將 google 登錄(沒有 firebase)添加到我的顫振應用程式中。
我創建了谷歌云專案,創建了 oauth 同意螢屏和憑據。我在用
google_sign_in: ^5.3.2
googleapis: ^9.0.0
我也必須添加
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.googleusercontent.apps.618518636914-abc</string>
</array>
</dict>
為了讓 ios 啟動瀏覽器進行谷歌登錄,我可以輸入電子郵件和密碼,然后應用權限螢屏(此應用想要訪問您的谷歌驅動器...)螢屏短暫出現并消失,我可以看到這個終端錯誤
[VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: PlatformException(sign_in_failed, org.openid.appauth.oauth_token, invalid_audience: Audience is not a valid client ID., null)
#0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607:7)
#1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:177:18)
<asynchronous suspension>
#2 MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:377:43)
<asynchronous suspension>
#3 GoogleSignIn._callMethod (package:google_sign_in/google_sign_in.dart:247:30)
<asynchronous suspension>
#4 GoogleSignIn.signIn.isCanceled (package:google_sign_in/google_sign_in.dart:377:5)
<asynchronous suspension>
這是用于登錄的代碼
class GoogleSignInApi {
static final _googleSignIn = GoogleSignIn(
hostedDomain: "",
clientId:
"618518636914-abd.apps.googleusercontent.com");
static Future<GoogleSignInAccount?> login() => _googleSignIn.signIn();
}
我提到了這篇文章Google Api 和 android Oauth INVALID_AUDIENCE 錯誤,但我的客戶端 ID 是正確的,并且它的型別僅為 iOS 客戶端(在 google oauth 憑據中)并且Google 在 iOS 13 GM 上登錄失敗這是針對純 iOS 專案的,它可能是仍然相關。但我無法弄清楚AppAuth顫振使用的 iOS 版本google_sign_in。
任何幫助將不勝感激,謝謝。
uj5u.com熱心網友回復:
請檢查以下步驟
打開 xcode 并選擇 runner,然后右鍵單擊 runner 并選擇 add files to runner。在彈出視窗中確保選中復制檔案。瀏覽并選擇 Google 服務 plist 檔案。
確保您在 Info.plist 中添加了來自 GoogleServicesInfo.plist id 的反向客戶端 id
從設備中洗掉現有應用程式并重新安裝。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/485208.html
上一篇:海關alertViewremoveFromSuperviewandnotfound不符合預期型別'CastingPromptViewDelegate'
