我正在使用 Zoho OAuth 2.0,并且我已按照 https://www.zoho.com/crm/help/api/v2/#oauth-request 中的步骤进行操作获取访问 token 和刷新 token 。但是我有一些问题。
这是一个场景:
1. Get authorization token
2. From authorization token, get access token and refresh token.
3. After one hour, I use the refresh token. (then I receive a new access token) - As stated here https://www.zoho.com/crm/help/api/v2/#refreshing-tokens
4. After that, another hour, how is it possible for me to get another access token? As refresh token expires in an hour (similar to access token I assume).
5. When I refresh token, only a new access token is given but not a new refresh token. So after one hour I cannot do another refresh again.
有人知道如何实现吗?
最佳答案
我自己有一个类似的用例,但我必须说它的文档很少。您的应用程序应该有一个“静态”刷新 token ,并使用它每小时生成一个新的访问 token 。
Auth ----> Refresh --(every hour)--> Access
因此,对于我的后端,我使用预先生成的刷新 token 并在该小时的时间到时生成访问 token 。使用此访问 token 与 API 进行正常交互。
我建议您阅读来自多个 Zoho 模块的文档,因为它们很差,您可能需要多个示例才能真正理解它,即使您只使用一个模块(大多数时候 auth 部分实际上是相同的)。你可以开始here和 here .
关于java - Zoho OAuth 2.0 多次刷新 token ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52534581/