簡體   English   中英

Google登錄無法在Cordova應用中使用

[英]Google Sign-in not working in an Cordova App

因此,在此指南的幫助下,我創建了一個登錄頁面(使用Google): https : //developers.google.com/identity/sign-in/web/build-button

  • 它在任何瀏覽器中都可以正常工作,但在我的Cordova應用程序中卻不能。

  • 通常,如果我單擊“使用Google登錄”按鈕,它應該會打開一個新窗口,但是在Cordova應用程序中不會彈出新窗口


我的短期解決方案:

現在,我只是在Inappbrowser( https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-inappbrowser/index.html )中打開登錄頁面即可,但我不要認為這是解決此問題的好方法。

感謝您的幫助,在此先感謝!

已經有一個科爾多瓦圖書館為這個 Github倉庫看看

我個人更喜歡另一個科爾多瓦圖書館,而不是公認的答案中提到的圖書館。 Eddy Verbruggen的cordova-plugin-googleplus ”插件/庫具有非常出色的文檔以及更多功能


我選擇Eddy Verbruggen的插件/庫的原因之一:

在帶有接受的答案庫的 Google登錄名返回以下JSON對象(如果登錄成功)的情況下,

obj.Name    // "Tester"
obj.Email   // "tester@testing.com"
obj.Gender  // "1"

Eddy Verbruggens插件/庫返回以下對象,該對象具有更多信息:

obj.email          // "eddyverbruggen@gmail.com"
obj.userId         // user id
obj.displayName    // "Eddy Verbruggen"
obj.familyName     // "Verbruggen"
obj.givenName      // "Eddy"
obj.imageUrl       // "http://link-to-my-profilepic.google.com"
obj.idToken        // idToken that can be exchanged to verify user identity.
obj.serverAuthCode // Auth code that can be exchanged for an access token and refresh token for offline access
obj.accessToken    // OAuth2 access token

在插件/庫的GitHub存儲庫中可以看到其他很棒的功能/差異。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM