1.Setting up GMail API

1.Creating a Google Cloud Account

  1. Go to Console

  2. Create a new project by choosing Select a project > NEW PROJECT

  3. Provide a Project Name (for eg Auto CDSL)

Create a new project

5. Now in the search bar type "gmail api" and select GMail API

Select GMail API

6. Now click on ENABLE

7. Now select Credentials from the left panel

8. Next select CONFIGURE CONSENT SCREEN

9. Select External and CREATE

10. Under the App information section provide :

App Name : AutoCDSL (you can give any name)

User support email : (your email)

You can leave the rest of the field and under Developer contact information as well you can provide your email

SAVE AND CONTINUE

11. Next Under Scopes section select ADD OR REMOVE SCOPES

Select gmail.readonly

select Gmail API gmail.readonly (View your email messages and settings) which is on the third page and click on UPDATE at bottom.Click on SAVE AND CONTINUE

12. Under Test users , select ADD USERS and enter your same email earlier entered. Click on ADD

Enter your email in the text box

Now select GO BACK TO DASHBOARD

13. Now from the side panel select Credentials then CREATE CREDENTIALS

14. Select OAuth client ID

15. Select Application type as Desktop app

leave the name as default and select CREATE

16. Now a popup window will appear and click on DOWNLOAD JSON

save this file as credentials.json

Remember not to share this file with anyone

UPDATE :

Now under the OAuth consent section the App might will be in the TESTING mode , the problem with this mode is that the token.json file (which will be generated in next step) will have a validity of only 7 days either you can go with this way or you can change the mode to PRODUCTION through which we can avoid this

Earlier in Testing

Select PUBLISH APP

Now in Production

Congratulations ! you have completed step 1 you process to next setp

Last updated