Using Postman to access OAuth 2.0 Google APIs

前端 未结 6 817
深忆病人
深忆病人 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:26

    1. go to https://console.developers.google.com/apis/credentials
    2. create web application credentials.

    Postman API Access

    1. use these settings with oauth2 in Postman:

      • Auth URL = https://accounts.google.com/o/oauth2/auth
      • Access Token URL = https://accounts.google.com/o/oauth2/token

        1. Choose Scope for the HTTP API
        2. Generate Token
        3. to add Schema use:

    SCOPE = https: //www.googleapis.com/auth/admin.directory.userschema

    post https: //www.googleapis.com/admin/directory/v1/customer/customer-id/schemas

    {
      "fields": [
        {
          "fieldName": "role",
          "fieldType": "STRING",
          "multiValued": true,
          "readAccessType": "ADMINS_AND_SELF"
        }
      ],
      "schemaName": "SAML"
    }
    
    1. to patch user use:

    SCOPE = https://www.googleapis.com/auth/admin.directory.user

    PATCH https://www.googleapis.com/admin/directory/v1/users/admin@email.com

     {
      "customSchemas": {
         "SAML": {
           "role": [
             {
              "value": "arn:aws:iam::123456789123:role/Admin,arn:aws:iam::123456789123:saml-provider/GoogleApps",
              "customType": "Admin"
             }
           ]
         }
       }
    }
    

提交回复
热议问题