Is it possible to authenticate user manually with oauth2

Posted by iixi on Stack Overflow See other posts from Stack Overflow or by iixi
Published on 2012-10-22T12:43:53Z Indexed on 2012/10/23 17:01 UTC
Read the original article Hit count: 135

I want to authenticate a user with oauth2 to access google drive. I can get the access token required when using AccountManager to retrieve an account and then get the token with:

mgr.blockingGetAuthToken(account, ApiConst.DRIVE_AUTH_SCOPE, true);

But I want the user to be able to authenticate by providing username and password instead of using the account added to the phone. Is this possible?

EDIT

So I have tried to implement the authorization in a WebView. I followed this example. I have extracted the code request parameter but the code used to retrieve the access token seems to be deprecated and not compatible with the packages used by Google Drive SDK. This is the code used to retrieve the access token in the example:

AccessTokenResponse accessTokenResponse = new GoogleAuthorizationCodeGrant(new NetHttpTransport(),
new JacksonFactory(),
OAuth2ClientCredentials.CLIENT_ID,
OAuth2ClientCredentials.CLIENT_SECRET,
code,
OAuth2ClientCredentials.REDIRECT_URI).execute();

Can this be done in some other way or should I just give up?

© Stack Overflow or respective owner

Related posts about android

Related posts about google-drive-sdk