Retrofit OAuth
A small demo how to use Retrofit to retrieve an OAuth2 access token from a Google account and use it to read the user's Google profile.
Run the demo
- create a new project: console.developers.google.com,
and go to
APIs & auth
Credentials
Create New Client ID
Installed application
andOther
Create Client ID
- copy the
Client ID
andClient secret
APIs
- enable
Google+ API
- enable
- create a file called
local.properties
in the root of this project and add the keysclient_id
andclient_secret
to it (and the corresponding values from step 1, of course) - run the main class
by executing
mvn exec:exec
, and follow the instructions on the console