2014-09-04 21 views
1

我成功地實施了谷歌帳戶登錄這裏使用教程針對Android:我可以使用Google Plus登錄來驗證應用引擎中的OAuth方法嗎?

https://developers.google.com/appengine/docs/java/endpoints/getstarted/clients/android/add_auth_code

這讓我的應用程序成功地使用端點應用程序引擎,而認證。

但是現在我想執行一些Google Plus功能,即:獲取有關用戶的一些信息。我遵循了G +代碼登入如下:

https://developers.google.com/+/mobile/android/getting-started#step_4_initialize_the_googleapiclient

我想知道的是,如果這2種方法能以某種方式進行合併是什麼?我覺得我要求用戶使用他的Google帳戶登錄兩次......無論如何,G +的GoogleApiClient可用於生成Google終端身份驗證所需的憑據嗎?

回答

1

使用Google+登錄後,您幾乎可以與Backend API交談。像這樣的事情是我做的:

@Override 
    public void onConnected(Bundle bundle) { 

    // Update the user interface to reflect that the user is signed in. 
    mSignInProgress = STATE_DEFAULT; 

    if (BuildConfig.DEBUG) { 
     Log.i(LOG_TAG, "Signed in"); 
    } 
    final String accountName = Plus.AccountApi.getAccountName(mGoogleApiClient); 
    credential.setSelectedAccountName(accountName); // private GoogleAccountCredential credential; 


    // call your GAE stuff 


    } 
相關問題