Can somebody provide some sample code for the oauth 2 Resource Owner Password Grant Type?

58 views
Skip to first unread message

john....@gmail.com

unread,
Feb 3, 2015, 4:18:32 PM2/3/15
to google-oauth...@googlegroups.com
I would like to use the google-oauth-java client to use the Resource Owner Password Grant Type.

So it would need to do something like this:

curl -v -X POST curl -v -X POST -d client_id=someclient&client_secret=xxx&grant_type=password&sername=admin&password=admin https://localhost:9443/oauth2/token

and from then on use the received access_token or if necessary the refresh_token? 

Can this useless be done with the google-oauth-java client library?


Daniel Wang

unread,
Feb 3, 2015, 5:01:52 PM2/3/15
to google-oauth...@googlegroups.com
Yes, Resource Owner Password Credentials Grant is implemented in this library. The Javadoc for PasswordTokenRequest has an example that does pretty much exactly what you are asking for:

Reply all
Reply to author
Forward
0 new messages