- go to https://cloud.google.com/
- click on Console
- In Console dashboard, select a project or create a new project
- If creating new project, click on NEW PROJECT. Give your project a name and click on CREATE.
- Go to the Nagivation menu and select APIs & Services, then Library.
- At the search bar, search "Gmail API", click on it and select Enable.
- Repeat step 6 and 7 for other Google APIs.
- In your dashboard, go to the Nagivation Menu, API & Services, OAuth consent screen.
- Select User Type as External for testing purposes, and click on Create.
- Under App information, give your app a name and include an User support email (you can use your personal gmail address for that).
- Skip the rest of the sections as we do not need them in our development.
- Under Developer contact information, you can include your own gamil address. Click on Save and Continue.
- Skip the whole section on Scopes and click on Save and Continue.
- Under Test User, we skip that as well, click on Save and Continue.
- Review the OAuth consent screen page.
- Go back to the OAuth consent screen and click on Publish App.
- Go to Nagivation menu, API & Services, click on credentials.
- Click on + create credentials.
- Select OAuth Client ID
- For Application type, select Desktop app.
- Give your OAuth 2.0 client a name.
- Click on create.
- The OAuth client account is now created. Download the JSON file and save it in your project folder.
- If the JSON file is lost, you can go back to the credentials page, under OAuth 2.0 Client IDs, click the download button under Actions to download tje JSON file again.
- Create a virtual environment for your project first and activate the virtual environment.
- Pip install the following packages
pip install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib