【发布时间】: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