How To Get Oauth Token From Googleapiclient
I am trying to build an Android application that created a spreadsheet in Google Drive and then adds some data to it. I can successfuly create the spreadsheet using the Google Driv
Solution 1:
Yes you can just use
GoogleAccountCredential mCredential;
String[] SCOPES = {"https://www.googleapis.com/auth/userinfo.profile"};
mCredential = GoogleAccountCredential.usingOAuth2(mContext, Arrays.asList(SCOPES))
.setBackOff(newExponentialBackOff())
.setSelectedAccountName(ACC_NAME);
GoogleAuthUtil.getToken(mContext, mCredential.getSelectedAccountName(),SCOPE)
Solution 2:
You can use GoogleAuthUtil.getToken()
call this method in an AsyncTask as it performs a network operation.
Post a Comment for "How To Get Oauth Token From Googleapiclient"