Google smart home 无法通过OAuth 2.0检索agentUserId
按照下面网站上的说明操作时,我陷入了第2步 单击“为令牌交换授权代码”后,我没有得到任何代码,但出现Google smart home 无法通过OAuth 2.0检索agentUserId,google-smart-home,oauth2-playground,Google Smart Home,Oauth2 Playground,按照下面网站上的说明操作时,我陷入了第2步 单击“为令牌交换授权代码”后,我没有得到任何代码,但出现401未经授权的错误 不知道在测试过程中出现了什么问题,因为操作本身工作正常 这是OAuth游乐场的输出: Host: oauth.teletask.be Content-length: 169 content-type: application/x-www-form-urlencoded user-agent: google-oauth-playground code=XIspHj&a
401未经授权的
错误
不知道在测试过程中出现了什么问题,因为操作本身工作正常
这是OAuth游乐场的输出:
Host: oauth.teletask.be
Content-length: 169
content-type: application/x-www-form-urlencoded
user-agent: google-oauth-playground
code=XIspHj&redirect_uri=https%3A%2F%2Fdevelopers.google.com%2Foauthplayground&client_id=***********&client_secret=************&scope=&grant_type=authorization_code
HTTP/1.1 401 Unauthorized
X-xss-protection: 1; mode=block
X-content-type-options: nosniff
Transfer-encoding: chunked
Expires: 0
Www-authenticate: Basic realm="oauth2/client"
Server: nginx/1.14.1
Connection: keep-alive
Pragma: no-cache
Cache-control: no-cache, no-store, max-age=0, must-revalidate
Date: Thu, 21 Nov 2019 14:59:59 GMT
Strict-transport-security: max-age=31536000 ; includeSubDomains
Content-type: application/json;charset=UTF-8
X-frame-options: DENY
{
"status": 401,
"timestamp": "2019-11-21T14:59:59.599+0000",
"message": "Unauthorized",
"path": "/auth/oauth/token",
"error": "Unauthorized"
}
401错误是由您的OAuth服务器(
OAuth.teletask.be
)生成的,特别是当它从Google收到授权代码授权时,您作为令牌端点输入的端点。您应该检查服务器日志,以确定有关服务器拒绝请求原因的更多详细信息
这里常见的问题包括拒绝
重定向uri
或客户端id
,因为它们与预期值不匹配。也可能是您的授权代码的生存期太短,并且在您点击按钮将其交换为令牌之前,代码过期。添加了“重定向uri”,并且“客户端id”正确。“访问令牌有效性”为900秒。但这可能不是授权代码的过期时间。我想它没有设定,所以它不会过期?当我通过Postman获得新的访问令牌时,它可以正常工作,但是交换的步骤是自动、直接完成的。来自oauth服务器的日志:>授权代码由您的服务器验证,因此由您的服务器逻辑来确定它接收的代码是否有效。您的错误日志当前状态为“访问被拒绝(用户是匿名的)”,这可能与此相关。