开发人员的Twitter“离线"访问权限? [英] Twitter 'Offline' Access for Developers?

查看:155
本文介绍了开发人员的Twitter“离线"访问权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直与社交集成和oauth授权框架紧密合作.我知道,像Facebook一样,Twitter为其应用程序实现了oauth挂钩.我的问题是,有没有办法让访问令牌永远保持活动状态?就像Facebook拥有其离线访问权限一样,我希望只能请求用户一次验证我的应用程序(这仅仅是出于易于使用的目的).

I've been working closely with social integrations and the oauth framework for authorization. I know that, like Facebook, Twitter implements an oauth hook for its applications. My question is, is there a way to keep an access token active forever? Much like Facebook has its offline access permission, I would like to be able to only request that the user validate my app once (this is simply for an ease-of-use purpose).

推荐答案

为Twitter实现OAuth时,您会收到两个令牌,分别称为OAuthToken和OAuthTokenSecret.您可以将这些值存储在设置文件或Cookie或数据库(或其他数据库)中,然后在将来提交API请求时使用这些令牌.这样就无需用户每次都对应用程序进行授权.

When you implement OAuth for Twitter, you receive two tokens called OAuthToken and OAuthTokenSecret. You store these values in a settings file or a cookie or a database (or whatever) and then you use those tokens when submitting API requests in the future. This removes the need for the user to authorize the application every time.

现在,如果用户撤消了您应用程序的权限,则令牌将不再起作用.

Now, if the user revokes your application's permissions, then the tokens will no longer work.

这篇关于开发人员的Twitter“离线"访问权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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