初识oauth: 为API访问授权提供一个开放的标准

原址:[u]http://iceskysl.1sters.com/?action=show&id=419[/u]

最近在准备一些API设计开发工作,初步了解了下oauth,OAuth是由Blaine Cook、Chris Messina、Larry Halff 及David Recordon共同发起的,目的在于为API访问授权提供一个开放的标准。
oauth目前看来进展比较顺利,可以看到其有主流语言的lib(Java、C#、Objective-C、Perl、PHP及Ruby语言),目前支持oauth的API有twitter,douban等应用。

OAuth is the great new standard allowing your users to use your application to talk to their accounts on other applications. I won’t go more into it here as it’s pretty well covered on the OAuth site.

OAuth’s Goal
Website X can access your protected data at API Y

All without sharing your password off-site
especially when there isn’t one like with OpenID
其基本流程为:

Register your consumer application with the OAuth compliant service to receive your Consumer Credentials (This is only done once)
You initiate the OAuth Token exchange process for a user by requesting a RequestToken from the Service
You store the RequestToken in your database or in the users session object
You redirect your user to the service providers authorize_url with the RequestToken’s key appended
Your user is asked by the service provider to authorize your RequestToken
Your user clicks yes and is redirected to your CallBack URL
Your callback action exchanges the RequestToken for an AccessToken
Now you can access your users data by performing http requests signed by your consumer credentials and the AccessToken.
????
PROFIT!!!
如果你想了解,请参考如下文档,如果你有经验,请分享,谢谢!

参考文档:

Developing OAuth clients in Ruby[url]http://stakeventures.com/articles/2008/02/23/developing-oauth-clients-in-ruby[/url]
How to turn your rails site into an OAuth Provider [url]http://stakeventures.com/articles/2007/11/26/how-to-turn-your-rails-site-into-an-oauth-provider[/url]
OAuth不断获得动力
Rails plugin for OAuth
OAuth implementation for Ruby
豆瓣 API 认证授权说明
The How of OAuth --这个PPT挺不错
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值