Google API刷新令牌已过期或已撤销 [英] Google API refresh token has been expired or revoked

查看:264
本文介绍了Google API刷新令牌已过期或已撤销的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Google Ads php库( https://github.com/googleads/googleads-php-lib ),以按照Google在此处的说明(

I am using a Google Ads php library (https://github.com/googleads/googleads-php-lib) to manage my own google ads account, following Google's instructions here (https://developers.google.com/adwords/api/docs/guides/first-api-call)

(实际上,我已经这样做了很多年,但是最近我改用了Google Cloud Platform中的其他项目,因此我不得不更新自己的凭据并获得新的 refresh令牌)

(I've actually been doing this for many years without a problem, but I recently switched over to using a different project in the Google Cloud Platform, so I had to update my credentials and get a new refresh token)

要获取新的刷新令牌,我运行了名为 GetRefreshTokenWithoutIniFile.php 的php脚本(该脚本可让我授予脱机访问权限并检索新的刷新令牌,存储在文件 auth.ini 中以备将来使用.

To get a new refresh token, I ran the php script called GetRefreshTokenWithoutIniFile.php (which allows me to grant offline access and retrieve a new refresh token, which I store in a file auth.ini for future use).

刷新令牌持续了几天,直到我看到此错误:

The refresh token last for a few days, before I see this error:

{
    "error" : "invalid_grant",
    "error_description" : "Token has been expired or revoked."
}

多年以来,我一直在使用上述方法,并且刷新令牌从未过期.但是,现在似乎每隔两天就会过期.我当然不是没有用完刷新令牌(我只请求一个),并且用户没有撤​​消访问权限(用户是 me ).因此,这些类似的答案对我没有帮助:

I have been using the above method for years and the refresh token has never expired. However, it now seems to expire every couple of days. I am certainly not 'running out' of refresh tokens (I only request one), and the user is not revoking access (the user is me). For that reason, these similar answers don't help me:

  • 'Token has been expired or revoked' - Google OAuth2 Refresh token gets expired in few days suggests an issue with 'security activity', but I see no security issues in my google account.

Google令牌刷新返回"令牌已过期或已撤消."

Google token refresh returns "Token has been expired or revoked." and Since couple of days Refresh token has been automatically expired suggest the problem may be too many refresh tokens - however, I only retrieve the token once and re-use the same one (until it expires!)

根据令牌已过期或撤消-Google Ads ,除非应用处于生产"模式,否则刷新令牌将不会持续存在.但是,我尝试了该解决方案,但该方法无效:令牌在几天后仍然失效.

According to Token has expired or revoked - Google Ads, a refresh token won't persist unless the app is in 'production' mode. However, I tried that solution and it did not work: the token still expires after a few more days.

还有其他想法吗?

推荐答案

更新:这不能解决问题

根据令牌已过期或被撤销-Google广告,除非应用处于生产"模式,否则刷新令牌将不会保留.

According to Token has expired or revoked - Google Ads, a refresh token won't persist unless the app is in 'production' mode.

推荐的解决方案是选择发布应用"从Google API控制台.我尝试了此操作,但不幸的是,成功使用刷新令牌几天后,刷新令牌再次过期.

The recommended solution is to select "Publish App" from the Google API console. I tried this out, but unfortunately, after a few days of using the refresh token successfully, the refresh token has expired again.

这篇关于Google API刷新令牌已过期或已撤销的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆