OAUTH 2.0 Authorization with Gmail API in Postman

Below tutorial will explain how to Authorize Gmail API Requests using OAUTH 2.0 Token in Postman.

Steps to Create GMAIL API OAUTH 2.0 Credentials

1. Navigate to https://console.developers.google.com/apis with your Google Account.

2. Click the projects dropdown on the top of the page

3. Click on NEW PROJECT to create a new project. Enter the Project name and click on CREATE.

4. Select your new project from the dropdown.

5. Click on Configure Consent Screen or click on the OAuth consent screen from the left menu.

6. Choose the User Type as External in Oauth consent screen and click on CREATE

7. Enter your Application name like ‘Postman-Training’ and click on SAVE

8. Click on Credentials from the left menu

9. Select OAuth client ID from CREATE CREDENTIALS menu at the top

10. Select Application type as Web Application and enter any Name such as “Web Client 1”

Also Add the following URI in Authorised redirect URIs : https://oauth.pstmn.io/v1/callback

11. Click on CREATE

12. OAUTH client created screen will appear with your Client Id and Client Secret. Save these values in a secure file.

13. Click on Library from the left menu.

14. Select Gmail API from the API Library.

15. Click on Enable to enable the Gmail API for your application

Steps to use OAUTH 2.0 Authorization to send GMAIL API Request:

1. Add a new API Request in Postman like to Get List of All Email Messages from your GMAIL Account.

https://www.googleapis.com/gmail/v1/users/{{userId}}/messages (userId is your Gmail Email Id)

2. Select Authorization Type as OAUTH 2.0

3. Click on Get New Access Token.

4. Enter all the details on the form as shown below. Replace ClientID and Client Secret with your own values.

5. Click on Request Token

6. Authorize your Gmail Account to access Postman.

7. Authentication Completed message should be displayed in both browser and your Postman UI.

8. Manage Access Tokens page will be displayed with the new Access Token generated. Click on Use Token.

9. Now click on Send to send the API Request.

10. Request will be successfully sent. Response will contain list of all the messages ID.

 

For detailed step by step instructions and to create additional Gmail Requests, watch this video:

 

 

Share

Bijan Patel

Founder & Creator of QAScript | 12+ years of IT Experience | Full Stack Automation Engineer | Blogger | Trainer

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!