Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined local variable or method with developer strategy? #1004

Open
nolyoi opened this issue Jun 30, 2020 · 1 comment
Open

Undefined local variable or method with developer strategy? #1004

nolyoi opened this issue Jun 30, 2020 · 1 comment

Comments

@nolyoi
Copy link

nolyoi commented Jun 30, 2020

Configuration

  • Provider Gem: omniauth
  • Ruby Version: 2.7.1
  • Framework: Rails 6
  • Platform: Ubuntu 20.04

Expected Behavior

I am expecting the user to be created using the developer strategy on my local env. According to the docs auth['info']['name'] and auth['uid'] are the correct way to retreive this hash, no?

Actual Behavior

undefined local variable or method auth' for #SessionsController:0x000055a2ebdbce80`

Steps to Reproduce

Here is how my controller is currently configured.

  def omni
    @user = User.find_or_create_by(uid: auth['uid']) do |u|
      u.name = auth['info']['name']
      u.uid = auth['uid']
    end

    pp request.env['omniauth.auth']
    session[:user_id] = @user.id
    
    redirect_to root_path
  end
@ioilmio
Copy link

ioilmio commented Oct 6, 2020

I experienced something like this;
Have you included
:omniauthable, omniauth_providers: %i[github facebook](change accordingly with your provider name) in your model?
in any case i suggest to follow the wiki about omniauth on devise https://github.com/heartcombo/devise/wiki/OmniAuth:-Overview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants