我遇到了与 this 相同的错误.就我而言,当应用尝试通过 Google Cloud Client API 上传文件时,就会发生这种情况.
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
我加载令牌的方式是读取服务帐户 json 文件,并将其附加到 PHP 中的 CURLOPT_HTTPHEADER
.过去一个月确实正常,所以我猜测谷歌改变了授权方式.
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?
我几乎在同一时间偶然发现了同样的问题,所以我预计会出现 Google 的通用错误,但我的计算机上发生了以下情况:
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
在我的情况下是由于计算机时钟的同步不良引起的,其中执行的代码有 5 分钟的延迟(由于内部时钟的电池有问题).当我手动将计算机的内部时间更改为正确的时间时,它又开始工作了.
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
这篇关于令牌必须是短期令牌并且在合理的时间范围内的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!