【问题标题】:Using postman + oauth2 to access Google Apps Admin SDK使用 postman + oauth2 访问 Google Apps Admin SDK
【发布时间】:2016-09-27 15:13:45
【问题描述】:

我正在努力让 oauth2 在邮递员和 Google Apps Admin Sdk 之间工作。我在谷歌控制台中创建了一个客户端应用程序,并将授权重定向 URI 设置为https://www.getpostman.com/oauth2/callback,我在邮递员中的设置如下

Auth URL          - https://accounts.google.com/o/oauth2/v2/auth
Access Token URL  - https://www.googleapis.com/oauth2/v4/token
Client Id         - some id here
Client Secrent    - some secret here
Scope             - https://www.googleapis.com/auth/admin.directory.user.readonly
Token Name        - Google
Grant Type        - Authorization Code
Request Access Token Locally - Checked

这会在登录后返回一个令牌 - xyz

我使用 url 中的令牌发出 GET 请求

https://www.googleapis.com/admin/directory/v1/users?key=xyz

我得到的错误如下

{
  "error": {
    "errors": [
      {
        "domain": "global",
        "reason": "required",
        "message": "Login Required",
        "locationType": "header",
        "location": "Authorization"
      }
    ],
    "code": 401,
    "message": "Login Required"
  }
}

从我读过的内容来看,这应该可以。我还需要在哪里登录?我做错了什么?

【问题讨论】:

    标签: oauth-2.0 google-admin-sdk postman


    【解决方案1】:

    玩了一圈后,我发现我的网址不正确。将key 更改为access_token 就成功了。

    请注意,请确保指定 domaincustomer 参数,否则您将收到错误的请求错误。

    【讨论】:

      猜你喜欢
      • 2014-02-05
      • 1970-01-01
      • 2020-03-04
      • 1970-01-01
      • 2013-09-13
      • 1970-01-01
      • 2013-03-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多