Rails - OAuth::Problem Exception: parameter_absent in 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::Problem Exception: parameter_absent
Code is as follows..
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,
开发者_如何学C :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
Thank you..
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
I got the same problem, you can fix it by using https://github.com/decioferreira/omniauth-linkedin-oauth2
精彩评论