2

Authorization Grant タイプ「Resource Owner Password Credentials」を使用するモバイル アプリを構築しています。

「oauth2」gemを使用してRubyでコードをテストしたところ、正常に動作しました

client = OAuth2::Client.new('the_client_id', 'the_client_secret', :site => "http://example.com")
access_token = client.password.get_token('user@example.com', 'sekret')
puts access_token.token

Java コード

OAuthService service = new ServiceBuilder()
        .provider(MyApi.class)
        .apiKey("the_client_id")
        .apiSecret("the_client_secret")
        .debug()
        .build();
// the next step should provide ('user@example.com', '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(); 

Scribe (または、できれば Android と互換性のある他のライブラリ) でユーザー名とパスワードを提供するにはどうすればよいですか?

現在、「DefaultApi20」を拡張する Scribe でこれを行う方法を見つけることができません。

4

1 に答える 1

3

これは単なる POST リクエストであることを理解しました

curl -i http://localhost:3000/oauth/token \
  -F grant_type=password \
  -F client_id=the_client_id \
  -F client_secret=the_client_secret \
  -F username=user@example.com \
  -F password=sekret
于 2013-11-09T17:45:14.903 に答える