ruby on rails 4 - Broken FB-omniauth after bundle update, invalid credentials -


the oauth data doesn't go controller action. can't understand what's wrong. there 1 more auth provider in controller , works core absolutely same.

devise  3.5.10  rails 4.2.4  devise.rb config.omniauth :facebook, figaro.env.fb_app_id, figaro.env.fb_app_secret, callback_url: 'https://chotam.ru/users/auth/facebook/callback',                   scope: 'email, publish_actions'  class users::omniauthcallbackscontroller < devise::omniauthcallbackscontroller  def facebook     logger.error "fb here" # it's no output here on request!!!     logger.error(request.env['omniauth.auth'])     result = user.find_for_facebook_oauth(request.env["omniauth.auth"], current_user)     @user = result[:user]     status = result[:status]     if @user       token = request.env["omniauth.auth"]["credentials"]["token"]       @user.account.update_attribute(:fb_token, token)       if status[:redirect] == 'added' || status[:redirect] == 'existed'         flash[status[:key]] = status[:value]         render 'devise/registrations/edit'       else         flash[status[:key]] = status[:value]         sign_in_and_redirect @user, event: :authentication       end     else       flash[status[:key]] = status[:value]       redirect_to new_user_registration_url     end   end 

update logger can see following:

e, [2017-03-28t23:46:41.255481 #21494] error -- : (facebook) authentication failure! invalid_credentials: oauth2::error, : {"access_token":"real_token","token_type":"bearer"$ 

how find what's wrong? , found users can't change passwords anymore.

ok...found way without updating gem.

you can add following in config/initializers/devise.rb file @ config.omniauth line:

client_options: {   site: "https://graph.facebook.com/v2.3",   authorize_url: "https://www.facebook.com/v2.3/dialog/oauth" }, token_params: {   parse: :json } 

ymmv full config, this:

config.omniauth :facebook, env["facebook_key"], env["facebook_secret"],     scope: 'email',     secure_image_url: true,     auth_type: 'https',     info_fields: 'email,name,first_name,last_name',     client_options: {         site: "https://graph.facebook.com/v2.3",         authorize_url: "https://www.facebook.com/v2.3/dialog/oauth"     },     token_params: {         parse: :json     } 

the main issue upgraded response format , without forced version pointer , token params parse new json format (instead of url encoded format), break @ response because didn't recognize spit api.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -