- Build project at Developer Console
- Get
client-id
andclient-secret
from project you build and set upredirect-url
(see project.clj) - Implement OAuth flow (see following work flow and
google.clj
- Goto
http://127.0.0.1:3449/auth/google
on your browser (use your host and port). - Your application redirects the user to Google.
- User grants permissions.
- Automatially call back to your application
http://127.0.0.1:3449/auth/google-callback
. - Exchange authorization
code
forid_token
- You can get user's information from the token.
{
"issuer" : "accounts.google.com",
"issued_to" : "CLIENT-ID",
"audience" : "CLIENT-ID",
"user_id" : "xxx",
"expires_in" : 3599,
"issued_at" : yyy,
"email" : "xxx@gmail.com",
"email_verified" : true
}
Now you can identify an user by user_id