Skip to content

Instantly share code, notes, and snippets.

@koalahamlet
Created August 14, 2014 22:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koalahamlet/c865b6fbce2504907a49 to your computer and use it in GitHub Desktop.
Save koalahamlet/c865b6fbce2504907a49 to your computer and use it in GitHub Desktop.
public ArrayList<String> getGooglePlusToken() {
ArrayList<String> accessTokens = new ArrayList<>();
try {
String accountName = Plus.AccountApi.getAccountName(googleApiClient);
String scope = "audience:server:client_id:" + Constants.GOOGLE_PLUS_SERVER_CLIENT_ID;
accessTokens.add(GoogleAuthUtil.getToken(context, accountName, scope));
Object[] scopes = {
Scopes.PLUS_LOGIN
};
accessTokens.add(
GoogleAuthUtil.getToken(context, accountName, "oauth2:" + TextUtils.join(" ", scopes)));
} catch (Exception e) {
Log.d(TAG, "google plus token exception");
}
return accessTokens;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment