Search code examples
authenticationtokengoogle-oauthgmail-api

In gmail authorization, as per google doc how code can be generated by redirect url?


As per Google doc:

Handling authorization requests

When a user loads your application for the first time, they are presented with a dialog to grant permission for your application to access their Gmail account with the requested permission scopes. After this initial authorization, the user is only presented with the permission dialog if your app's client ID changes or the requested scopes have changed.

Authenticate the user

This initial sign-in returns an authorization result object that contains an authorization code if successful.

But could not get how handling authorization flow can occur? Is there an endpoint for it?


Solution

  • I got an answer, request on: https://accounts.google.com/o/oauth2/auth?client_id=*****.apps.googleusercontent.com&redirect_uri=https://www.msn.com&scope=https://mail.google.com/&response_type=code&access_type=offline&prompt=consent

    Here, make sure you have specified scope in consent screen.

    It will redirect user to give access of gmail scopes after that you will be redirected to msn url. url itself contains code which will be further used to get access token. code you get will be used one time only.