简体   繁体   中英

RoR linkedin gem & OAuth::Problem (signature_invalid)

I am using Ruby 1.8.7, Rails 2.3.8, Linkdin 0.1.7, Roxml 3.1.5 and Oauth 0.3.6. In my accounts controller I am testing the code by Will Read (http://pivotallabs.com/users/will/blog/articles/1096-linkedin-gem-for-a-web-app). When I click "Ok I'll Allow it" button on linkdin, it lands on callback method and then crashes on this line:

atoken, asecret = client.authorize_from_request(session[:rtoken], session[:rsecret], pin)

with the following error trace:

OAuth::Problem (signature_invalid):

oauth (0.3.6) lib/oauth/consumer.rb:167:in `request'

oauth (0.3.6) lib/oauth/consumer.rb:183:in `token_request'

oauth (0.3.6) lib/oauth/tokens/request_token.rb:18:in `get_access_token'

linkedin (0.1.7) lib/linked_in/client.rb:35:in `authorize_from_request'

app/controllers/accounts_controller.rb:52:in `callback'

.....

Moreover, I checked the values of session for rtoken and rsecret and params[:oauth_verifier], and none of them was blank!

I had a similar issue. In my case the problem was that my consumer sent the request to an HTTP Uri. But the OAuth Server (Stash) had a redirect to httpS. As soon I changed the site url to HTTPS it worked for me.

Another reason can be that there is an Proxy in between. That needs some extra configuration.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM