I have a RoR application, running the Devise Gem for authentification. For my new API I've implemented the Gem "devise-token-auth": https://github.com/lynndylanhurley/devise_token_auth
Since I want Devise to run for the website and API authentication, I followed the extra tips in the following instruction as well (and als the FAQ of the Gem's Git): http://www.developingandrails.com/2015/02/api-authentication-with-devisetokenauth.html
I've deactivated Devise's :confirmable, but activated :omniauthable. Everything seems to be in place, but I'm getting the following error:
/Users/sebastianplasschaert/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/devise-3.5.2/lib/devise/rails/routes.rb:240:in `block in devise_for': Mapping omniauth_callbacks on a resource that is not omniauthable (ArgumentError)
Please add `devise :omniauthable` to the `User` model
And in my User model I start with the following code:
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :invitable, :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
:omniauthable
include DeviseTokenAuth::Concerns::User
So, :omniauthable seems to be there. When I deactivate:
include DeviseTokenAuth::Concerns::User
then everything works again (but I need it for my API authentication).
Any ideas on what I'm doing wrong?
for some reason include DeviseTokenAuth::Concerns::User
in removing the omniauthable
.
I fixed the issue adding it back:
devise :invitable, :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
:omniauthable
include DeviseTokenAuth::Concerns::User
devise :omniauthable
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With