How to setup GMAIL API - diogomartino/SAMPMailJS GitHub Wiki
How to setup GMAIL API
- Go to Google Console API and create a new project HERE.
- Select the project you just created
- Go to the APIs dashboard HERE.
- On the left side, click on CREDENTIALS.
- Click on OAUTH Consent Screen, change your product name to the one you like and hit SAVE
- Click on Credentials > Create Credentials > OAuth Client ID
- Choose Web Application, and in the last field enter https://developers.google.com/oauthplayground, and hit CREATE.
- Save your Client ID and your Client Secret somewhere, we will need it later.
- Go to https://developers.google.com/oauthplayground/
- On the top right side, click on the settings button, then click on Use your own OAuth credentials and paste your Client ID and your Client Secret. On the left, right by the Authorize APIs paste https://mail.google.com.
- Click on Authorize APIs. If some error pops up, go back to step 7 and make sure in the end of the url in the last field there is no slash (/). If there is, remove the URL and add again without the slash.
- In some browsers, there will be a warning telling you that your app is not validated. Ignore that warning and carry on logging in your Google account.
- After your authorization, you will be redirected to the same page as before, then click on Exchange Authorization code for tokens
- Click on Step 2, and save your Refresh Token somewhere, you will need it later.
By now you should have:
- Client ID
- Client secret
- Refresh Token