访问令牌立即失效

访问令牌立即失效

本文介绍了访问令牌立即失效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于一些用户(也许不是很少,考虑到我收到相关邮件的数量)与OAuth授权相关联的访问令牌似乎立即失效。用户通过正常的授权过程的指导下,他接受的权限,他将被重定向到正确的页面,其中包括访问令牌,但只要我的应用程序试图使用访问令牌来获取用户ID,会收到一个错误而不是:

for a few users (maybe not that few, considering the number of related mails I'm receiving) the access token associated with an OAUTH authorization seems to be immediately invalidated. The user is guided through the usual authorization process, he accepts the permissions, he is redirected to the right page which includes the access token, but as soon as my application tries to use the access token to get the user ID, an error is received instead:

{"error":{"message":"Error validating access token: Session has expired at unix time 0. The current unix time is 1323939801.","type":"OAuthException"}}

该offline_access是权限的一部分。除此之外,还有没有办法的原因是用户删除授权或修改密码,因为出现这种情况之后已经接受授权。在我的应用程序流程我已经尝试重试几次,从日志​​我收到我可以看到错误总是相同的:通过授权过程再次引导用户有没有用,因为用户再次重定向到该页面所述的access_token在片段。显然,为用户解决这个问题的唯一方法是删除从授权的应用程序列表中的应用程序,一遍做同样的事情(除非在第n次重试它开始工作,并不是所有的用户写回时,事情开始工作)。

The offline_access is part of the permissions. Besides, there's no way the cause is the user removing the authorization or changing password since this happens right after having accepted the authorization. In my app flow I already attempt a retry a few times and from the logs I receive I can see the error is always the same: guiding the user through the authorization process again has no use, since the user is redirected again to the page with the access_token in the fragment. Apparently the only way for a user to solve this is to remove the application from the list of authorized applications and do the same thing all over again (unless at the n-th retry it starts working, not all users write back when things start working).

这可能是什么原因?

推荐答案

离线访问越来越德precated,我也不会要求它了。相反,在iOS的SDK,至少有一个更新的方法。

Offline access is getting deprecated, I wouldn't ask for it anymore. Instead, in iOS SDK, at least, there's a renewal method.

这篇关于访问令牌立即失效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 10:36