Closed danishsatkut closed 7 years ago
Too bad if this package doesn't have this. I'm the owner of a website, and the app version doesn't need to be trusted again. So I want to make username password credentials like this one https://github.com/danielsz/android-oauth2-client
But this package is not maintained since may 2014
I don't want to hijack this issue, but since @Agent47DarkSoul asked: we've published a library to support Resource Owner Credentials Grant and all other grants of RFC 6749 called oauth2-essentials.
Oh Great news. I'll give it a try next week. Cause I have hijacked rest client template from codepath to use concurrently both Authorization Code and (my add) Client Credentials grant type.
No it does not support OAuth Resource Owner Also call OAuthPassword. However it is easy to build support for that create a new authorizeOAuthPassword method and put in the following code
public boolean authorizeOAuthPassword(String username, String password){
PasswordTokenRequest request = new PasswordTokenRequest(<NetHttpTransport Object>, JSON_FACTORY, new GenericUrl(<Token URL String>), username, password);
request.set("client_id",this.client.getClientId());
request.set("client_secret",this.client.getClientSecret());
if (scopes != null && scopes.length > 0) {
request.setScopes(Arrays.asList(scopes));
}
TokenResponse response = request.execute();
<Credential Object> = new Credential(com.google.api.client.auth.oauth2.BearerToken.authorizationHeaderAccessMethod());
<Credential Object>.setAccessToken(response.getAccessToken());
<Credential Object>.setExpiresInSeconds(response.getExpiresInSeconds());
return true;
}
@pradeepgudipati where would this method go? is it necessary to fork the repo?
It's been 2 years since I used this and I don't exactly remember now !!!. Later, I ran into problems with WebView as google had blocked auth requests from Webview based calls. I moved to using Custom Tabs. I now use AppAuth Android Library
I am a backend developer checking out some android oauth2 libraries. I want to know if this library supports the grant type "Resource owner credentials" as specified in OAuth specification. If not can anybody point me in the direction of the library that does?
Thanks.