Gem Oauth

shadow · August 02, 2012 · Last by Shadow replied at August 03, 2012 · 2914 hits
require 'rubygems'
require 'oauth'

@consumer = OAuth::Consumer.new( 'a5bdf64821f6cdf47f3', 'ae7118784a95d9d7e4b380487940be3e2734b8d6', { :site => 'http://sp.sb.mobage-platform.cn/social/api/oauth/v2/request_temporary_credential' } )
@request_token=@consumer.get_request_token

最近在弄 Oauth,对这个东西不是很了解,感觉网上说的很轻巧。郁闷的是我使用

CURL -d "" http://sp.sb.mobage-platform.cn/social/api/oauth/v2/request_temporary_credential

这个时候服务器给我返回的是

oauth_problem=version_rejected

但是我使用最上面提供的代码 在 irb 编辑的时候 返回的是

OAuth::Unauthorized: 404 Not Found
    from /Users/Shadow/.rvm/gems/ruby-1.8.7-p358/gems/oauth-0.4.6/lib/oauth/consumer.rb:220:in `token_request'
    from /Users/Shadow/.rvm/gems/ruby-1.8.7-p358/gems/oauth-0.4.6/lib/oauth/consumer.rb:137:in `get_request_token'

对这个不是很了解 希望大家给点意见. 或者有什么好的资料发下留言。我去学习下

看来大家都对 oauth 无爱 ,, 汇报下 我用 httpclient 解决了问题。

You need to Sign in before reply, if you don't have an account, please Sign up first.