ruby on rails - Omniauth Callback -


im using devise rails 4 app. authenticate facebook, linkedin , email.

i've started use figaro , change have made code swap password use email account out of production.rb application.yml file.

now, when test linkedin registration link, error saying went wrong (after pressing "register linkedin"). same error when try authenticate other options.

i have callback error in omniauth callback controller linkedin. line problem '@user.send_admin_email' below:

def linkedin     @user = user.find_for_linkedin_oauth(request.env["omniauth.auth"])       if @user.persisted?         @user.send_admin_mail          redirect_to root_path, :event => :authentication         # sign_in_and_redirect @user, :event => :authentication #this throw if @user not activated         #  set_flash_message(:notice, :success, :kind => "linkedin") if is_navigational_format?         else           session["devise.linkedin_data"] = request.env["omniauth.auth"]           redirect_to root_path         end       end 

i have mailer set sends me email tell me when there new registration. uses email address moved password production.rb application.yml

does know how resolve error?

thank much

hmm, seems "strong parameter" problem me. check "send_admin_mail" see if there "update_atributes" (or "save").

my guess user.rb like:

class user < activerecord::base ... attr_accessor :extras  def self.find_for_linkedin_oauth(access_token, signed_in_resource=nil)   ...   user = user.where(...)   ...   user.extras = access_token.extras   ... end  def send_admin_mail   ...   self.update_attributes(some_attribute: extras["some_attribute"])   ... end 

if doing this, "save" try update non-permitted parameter. correct version must this:

self.update_attributes(some_attribute: extras.permit(:some_attribute)) 

if i'm not wrong, first implementation worked in previous versions of strong parameters, not anymore.


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -