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.
- create a new project: console.developers.google.com,
and go to
APIs & authCredentialsCreate New Client IDInstalled applicationandOtherCreate Client ID- copy the
Client IDandClient secret
APIs- enable
Google+ API
- enable
- create a file called
local.propertiesin the root of this project and add the keysclient_idandclient_secretto 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