lynndylanhurley / lynndylanhurley/devise_token_auth

User Concern is removing Devise settings

Open
#319 10 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
3.6k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

When I include
include DeviseTokenAuth::Concerns::User

below my devise settings
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable, :omniauthable, :omniauth_providers => [:facebook, :google_oauth2]
include DeviseTokenAuth::Concerns::User

I am getting the following error
Mapping omniauth_callbacks on a resource that is not omniauthable (ArgumentError) Please add devise :omniauthable to the User model

I looked at the source code for
https://github.com/lynndylanhurley/devise_token_auth/blob/master/app/models/devise_token_auth/concerns/user.rb

I think the problem might be with

Hack to check if devise is already enabled

unless self.method_defined?(:devise_modules)
  devise :database_authenticatable, :registerable,
      :recoverable, :trackable, :validatable, :confirmable
else
  self.devise_modules.delete(:omniauthable)
end

I am using
Rails 4.2
devise (3.5.1)
devise_token_auth (0.1.31)
omniauth (1.2.2)
omniauth-facebook (2.0.1)
omniauth-google-oauth2 (0.2.6)
omniauth-oauth2 (1.3.1)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with app/models/devise_token_auth/concerns/user.rb, especially the devise_modules handling shown in the issue, and reproduce the error using the listed Rails, Devise, and devise_token_auth versions. Trace why an existing :omniauthable setting is removed, then verify that the User model retains the configured OmniAuth support without breaking the other Devise modules.

Written by the indexing model from the issue text.

Assessment

Tech stack
rails, ruby
Domain
api, authentication
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.