令牌必须是一个短暂的令牌,并且在合理的时间段内 [英] Token must be a short-lived token and in a reasonable timeframe
问题描述
我与此有相同的错误。
在我的情况下,当应用程序试图通过Google Cloud Client API上传文件时发生。
POST https://www.googleapis.com/oauth2/v4/token
400错误请求
无效的JWT:令牌必须是短暂的令牌,并且在合理的时间范围内
如何加载令牌是读取服务帐户json文件,并将其附加到 CURLOPT_HTTPHEADER
在PHP中。它在过去的一个月里确实工作正常,所以我猜测Google改变了授权方式。
有没有人遇到&解决了这个问题?
我几乎同时遇到同样的问题,所以我期待谷歌的一个通用bug,是我的电脑上发生的事情:
pre $ raise HttpAccessTokenRefreshError(error_msg,status = resp.status)
oauth2client.client .HttpAccessTokenRefreshError:invalid_grant:无效的JWT:令牌必须是短期令牌并且在合理的时间范围内
在我的情况下,由于执行代码的计算机时钟的同步时间差5分钟(由于内部时钟的电池故障)而导致的。当我手动将计算机的内部时间更改为正确的时间后,它再次开始工作。
这个解决方案在这里被提及,但不是全部错误消息
I am having the same error as this. In my case it is happening when the app is trying to upload a file via Google Cloud Client API.
POST https://www.googleapis.com/oauth2/v4/token
400 Bad Request
Invalid JWT: Token must be a short-lived token and in a reasonable timeframe
How I load the token is reading a service-account json file, and attach it to CURLOPT_HTTPHEADER
in PHP. It did work properly for the past one month, so I am guessing that Google changed the way of authorization.
Has anyone faced & solved this?
I stumbled upon the same issue at roughly the same time, so I expected a generic bug of Google but here is what had happened on my computer :
raise HttpAccessTokenRefreshError(error_msg, status=resp.status)
oauth2client.client.HttpAccessTokenRefreshError: invalid_grant: Invalid JWT: Token must be a short-lived token and in a reasonable timeframe
was caused in my case by a poor synchronisation of the computer's clock where the code was executed that had a lag of 5 minutes (due to a faulty battery for the internal clock). It started working again when I manually changed the internal time of my computer to the correct one.
This solution was mentionned here, but not with the full error message
这篇关于令牌必须是一个短暂的令牌,并且在合理的时间段内的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!