From my understanding to access the gmail API using XOAUTH authentication it is required you have a token and token secret if you wish to use the 3-legged-authentication.
I can obtain the token from the account manager AccountManager.KEY_AUTHTOKEN
but I am unsure how to obtain the token secret.
accountManager.getAuthToken(account, "oauth2:https://mail.google.com/", null, MainActivity.this,
new AccountManagerCallback<Bundle>() {
@Override
public void run(final AccountManagerFuture<Bundle> future) {
try {
final String token = future.getResult().getString(
AccountManager.KEY_AUTHTOKEN);
} catch (final Exception e) {
Log.e(TAG, e.getMessage(), e);
}
}
}, null);
Is it possible to obtain the token secret from the account manager or would I have to launch the browser to obtain this information?
From the research that I have concluded this is not possible.
However a possible solution to overcome this problem would to be to use the Signpost oAuth library which enables request tokens to be returned from the browser.