雅虎 OAuth 实现无法离线工作
我需要将 Delicious 书签下载到非 Web 应用程序,而无需持续的用户交互。我正在使用 Delicious 的 V2 API(使用 oAuth),但问题是它们的访问令牌似乎在一小时后过期。
我将用户重定向到雅虎进行一次性授权没有任何问题,但此处描述的内容(http://developer.yahoo.com/oauth/guide/oauth-refreshaccesstoken.html) 意味着我必须在用户访问令牌过期之前一直刷新我的访问令牌离开。
这真的是他们完成 oAuth 实施的方式吗?
I need to download my Delicious bookmarks to a non-web application without constant user interaction. I'm using Delicious's V2 API (using oAuth) but the problem is it seems their access tokens expire after one hour.
I don't have any issues with redirecting the user to Yahoo for a one time authorization, but what is described here (http://developer.yahoo.com/oauth/guide/oauth-refreshaccesstoken.html) means I would have to refresh my access tokens all the time before they expire when the user is away.
Is this really the way they've done their oAuth implementation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您只需在他们再次使用应用程序时刷新访问令牌,而不是在他们离开时刷新访问令牌。您可以传递之前过期的令牌并获得新的令牌作为回报。
You only need to refresh the access token when they come to use the application again, not while they're away. You can pass the previously expired token and get a new one in return.
这是一个问题吗?您只需要在访问令牌过期时进行额外的服务器端调用来刷新它(只要授权本身尚未过期,授权本身应该持续更长时间,并且在过期时需要用户交互)。
Is that a problem? You should only need to make an additional server-side call to refresh the access token if it expires (as long as the authorization itself has not expired, which should last longer, and would need user interaction when it expired).