2017-07-19 87 views
1

我正在使用native Google Plus插件與Ionic 3應用程序。谷歌加本地插件與webClientId

Login()方法是這樣的:

login(){ 

     GooglePlus.login({ 
      'webClientId': '*************************' 
     }).then((res) => { 
      console.log(res); 
     }, (err) => { 
      console.log(err); 
     }); 

    } 

這裏的問題是關於webClientId .Hence我已創建的應用程序2顯影劑控制檯上(iOS和Android),它示出了2個不同的webClientId s.So其值我應該給上述代碼嗎?

+0

你想獲得'idToken'或'serverAuthCode'嗎?或者它只是簡單的用戶認證? –

+0

不要刪除答案。我會測試,並會讓你知道。我正在等待我的後端開發者的反饋。之後,我會給你一個反饋。我想,你的回答是正確的我的簡單用例。 @SwapnilPatwa – Sampath

+0

好的,我以爲我錯過了'idToken'部分並感到困惑。 –

回答

1

偉大的鏈接:Ionic Google Authentication

插件鏈接:enter link description here

你並不需要把webClientId在GooglePlus.login()

您的登錄方法應該是(如果沒有其他選項) -

GooglePlus.login({}).then((res) => { 
    console.log(res); 
}, (err) => { 
    console.log(err); 
}); 

的iOS

你需要把REVERSED_CLIENT_ID在​​3210於iOS。

<plugin name="cordova-plugin-googleplus" spec="~5.1.1"> 
     <variable name="REVERSED_CLIENT_ID" value="com.googleusercontent.apps.967272422526-vu37jlptokv45glo2kciu9o2rddm7gte" /> 
</plugin> 

要找到你REVERSED_CLIENT_ID,在開發者控制檯去憑據,然後單擊上創建的iOS憑證和Download Plist

enter image description here

的Android

爲Android,你不需要任何的ID,它適用於Signing-certificate fingerprint,請確保您Signing-certificate fingerprintPackage name是正確的,同時創造oauth client id

enter image description here

如果你不與任何創建密鑰庫文件簽名apk文件,然後採取默認debug.keystore文件SHA-1 signing-certificate fingerprint

keytool -exportcert -keystore C:\Users\Username\.android\debug.keystore -list -v 

我已經使用了debug.keystore(windows)的最常用路徑。它可能會有所不同,只需查找.android dir即可。

+0

它只是顯示錯誤爲'10'.你知道爲什麼嗎? – Sampath

+0

其實,我需要爲Android設置。你已經提到iOS的不行嗎? – Sampath

+0

它只是顯示錯誤爲10?在android上? –