简体   繁体   中英

OAuth2::Error with LinkedIn

I'm using Rails and OAuth so users can sign in with LinkedIn. I'm following this tutorial http://www.sitepoint.com/rails-authentication-oauth-2-0-omniauth/ . I registered my app on LinkedIn Developers and followed the instructions to a T. However when use localhost to test the app, and I'm navigated to the LinkedIn authorize page, I get this Action Controller error message as a callback:

OAuth2::Error

invalid_request: missing required parameters, includes an invalid parameter value, parameter more than once. : Unable to retrieve access token : appId or redirect uri does not match authorization code or authorization code expired {"error_description":"missing required parameters, includes an invalid parameter value, parameter more than once. : Unable to retrieve access token : appId or redirect uri does not match authorization code or authorization code expired","error":"invalid_request"}

What can I do to resolve this, so OAuth with LinkedIn works? Here is my code in omniauth.rb

You can not set localhost directly as your callback. You can use 127.0.0.1:3000 instead of localhost to get it working.

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