Using Postman to access OAuth 2.0 Google APIs

前端 未结 6 820
深忆病人
深忆病人 2020-11-27 09:20

I am trying to access Proximity Google API using Postman chrome app. I have followed tutorials on postman and google dev website but I\'m still getting 401 error message.

6条回答
  •  再見小時候
    2020-11-27 10:11

    The current answer is outdated. Here's the up-to-date flow:

    We will use the YouTube Data API for our example. Make changes accordingly.

    Make sure you have enabled your desired API for your project.

    Create the OAuth 2.0 Client

    1. Visit https://console.cloud.google.com/apis/credentials
    2. Click on CREATE CREDENTIALS
    3. Select OAuth client ID
    4. For Application Type choose Web Application
    5. Add a name
    6. Add following URI for Authorized redirect URIs
    https://oauth.pstmn.io/v1/callback
    
    1. Click Save
    2. Click on the OAuth client you just generated
    3. In the Topbar click on DOWNLOAD JSON and save the file somewhere on your machine.

    We will use the file later to authenticate Postman.

    Authorize Postman via OAuth 2.0 Client

    1. In the Auth tab under TYPE choose OAuth 2.0
    2. For Access Token enter the Access Token found inside the client_secret_[YourClientID].json file we downloaded in step 9
    3. Click on Get New Access Token
    4. Make sure your settings are as follows:

    Click here to see the settings

    You can find everything else you need in your .json file.

    1. Click on Request Token
    2. A new browser tab/window will open
    3. Once the browser tab opens, login via the appropriate Google account
    4. Accept the consent screen
    5. Done

    Ignore the browser message "Not safe" etc. This will be shown until your app has been screened by Google officials. In this case it will always be shown since Postman is the app.

提交回复
热议问题