简体   繁体   中英

Devise + omniauth

The bottom line is that the authorization through facebook, twitter, linkedin in CallbacksController in request.env ['omniauth.auth'] comes only uid and provider, no additional informations extra, credentials, etc. . And it does not happen every time, multiple requests can be valid, and then randomly get a hash with only two parameters. Does anyone know what the problem is and how to solve it?

devise (3.2.3) omniauth (1.2.1) omniauth-oauth2 (1.1.2) oauth2 (0.9.3)

check you hash raising an exception

class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
   def facebook
     raise request.env["omniauth.auth"].to_yaml # <----------
     .
     .
     .

if is really empty or just with provider and uid only i should assume that you miss configure your devise initializer or the applications in their corresponding pages, but it will be really weird that all the configurations where wrong.

When using devise,and you wish to add a omniauth using facebook.There is a nice tutorial on rails casts. i recommend you follow the http://railscasts.com/episodes/360-facebook-authentication?view=asciicast and also follow this too. https://github.com/plataformatec/devise/wiki/OmniAuth%3A-Overview . you will find what you looking for.

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