Reputation: 3172
I am building a mobile app that uses the Authorization Grant type "Resource Owner Password Credentials"
Tested the code in Ruby with the "oauth2" gem and it works fine
client = OAuth2::Client.new('the_client_id', 'the_client_secret', :site => "http://example.com")
access_token = client.password.get_token('[email protected]', 'sekret')
puts access_token.token
Java code
OAuthService service = new ServiceBuilder()
.provider(MyApi.class)
.apiKey("the_client_id")
.apiSecret("the_client_secret")
.debug()
.build();
// the next step should provide ('[email protected]', 'sekret')
// because I am using "Resource Owner Password Credentials"
// http://tools.ietf.org/html/draft-ietf-oauth-v2-31#page-53
Token requestToken = service.getRequestToken();
How can I provide the username and password in Scribe (or with other library preferably compatible with Android)?
Right now I cannot find a way to do this with Scribe extending "DefaultApi20".
Upvotes: 2
Views: 1947
Reputation: 3172
I understand now that this is just a POST request
curl -i http://localhost:3000/oauth/token \
-F grant_type=password \
-F client_id=the_client_id \
-F client_secret=the_client_secret \
-F [email protected] \
-F password=sekret
Upvotes: 3