2

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".

0

1 Answer 1

3

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
Sign up to request clarification or add additional context in comments.

4 Comments

Did you ever find a way to do with using Scribe itself?
@TomLeese I used Retrofit for the client.public Interface MyService { @FormUrlEncoded @POST("/oauth/token") Token login(@Field("grant_type") String grant_type, @Field("client_id") String client_id, @Field("client_secret") String client_secret, @Field("username") String email, @Field("password") String pin); }
Did you mean scribe is not needed at all?
Yes, you can handle everything with HTTP requests or use Retrofit

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.