To access your Gmail account from the API, you will need to obtain the following values from Google's OAuth system:
clientId
clientSecret
refreshToken
- Open console.google.com
- Click create new project. Name and create.
- Search for "Gmail API" and click Enable
- Visit the OAuth consent tabard populate the form
- Visit the Credentials tab and click "CCReate Credentials -> OAuth client ID"
- Select "Web Application"
- Under
Authorized redirect URIs
pastehttps://developers.google.com/oauthplayground
(Without a trailing slash!) - Copy the generated Client ID and Client Secret.
- Visit https://developers.google.com/oauthplayground
- Click on the gear icon to open the Configuration menu
- Check the checkbox "Use your own OAuth credentials"
- Paste in your Client ID and Client Secret. Close the panel.
- Under "Select and Authorize APIs" select
Gmail API
. (Or customize the scope of your auth, such as compose-only) - Click
Authorize APIs
. Click through the Google login flow. - When authorization is complete click
Exchange authorization code for tokens
- Copy the Refresh Token