本文介绍了导轨 - 的OAuth ::问题例外:parameter_absent在LinkedIn的API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我Develoing使用OAuth宝石API中链接。同样的宝石可以正常使用了我的Twitter API,但LinkedIn的API的情况下,我收到请求令牌,当它试图获取访问令牌它返回错误
I am Develoing a Linked in APi using Oauth gem. The same gem is working perfectly for my Twitter API, But in the case of Linkedin API, I am getting the request token, and when it tries to get the access token it return the error
的OAuth ::问题异常:parameter_absent
code是如下。
consumerKey = "*************************"
consumerSecret = "*************************"
callbackUrl = "http://localhost/"
apiURL = "https://api.linkedin.com"
request_token_path = "/uas/oauth/requestToken"
access_token_path = "/uas/oauth/accessToken"
authorize_path = "/uas/oauth/authorize"
@consumer = OAuth::Consumer.new(consumerKey,consumerSecret, {
:site => apiURL,
:scheme => :header,
:http_method => :post,
:request_token_path => request_token_path,
:access_token_path => access_token_path,
:authorize_path => authorize_path
})
unless(params["oauth_token"].nil?)
@request_token = session[:request_token]
@access_token = @request_token.get_access_token
else
@request_token = @consumer.get_request_token(:oauth_callback => callbackUrl)
firstUrl = @request_token.authorize_url(:oauth_callback => callbackUrl)
session[:request_token] = @request_token
redirect_to firstUrl
end
感谢您..
推荐答案
最后我做到了,:oauth_verifier => PARAMS [:oauth_verifier]这是问题:)
Finally i did it, ":oauth_verifier => params[:oauth_verifier]" this was the problem :)
unless(params["oauth_token"].nil?)
@request_token = session[:request_token]
@access_token = @request_token.get_access_token(:oauth_verifier => params[:oauth_verifier])
else
@request_token = @consumer.get_request_token(:oauth_callback => callbackUrl)
firstUrl = @request_token.authorize_url(:oauth_callback => callbackUrl)
session[:request_token] = @request_token
redirect_to firstUrl
end
这篇关于导轨 - 的OAuth ::问题例外:parameter_absent在LinkedIn的API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!