devise_token_auth
devise_token_auth copied to clipboard
User Concern is removing Devise settings
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)
+1, Any word on this, I am running into the same issue.
I simply re-add omni auth.
devise :database_authenticatable, :async, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
:omniauthable, :omniauth_providers => [:facebook]
include DeviseTokenAuth::Concerns::User
devise :omniauthable # Because for some reason it gets rid of it.
+1, Also hit the issue when using the gem under a scope.
+1
Same here :/
This gem...
Noting this is still a problem.
+1
+1 still an issue, is there a way a solve it?
Issue is still present 😬
This commit is the one that introduced that delete
statement. The reason(commit message) kinda make sense.
I think they are expecting us not to directly setup omniauth in the model, but separately, like mentioned in Devise docs
It looks like this is necessary only when having more than one auth model; if that's not your case then this will cause only no-needed extra configuration
IMHO I'd remove that delete
statement and just add an entry in the docs explaining the incompatibility issue