我有一个RoR应用程序,运行Devise Gem进行身份验证.对于我的新API,我实现了Gem"devise-token-auth":https://github.com/lynndylanhurley/devise_token_auth
由于我希望Devise运行网站和API身份验证,我也遵循以下说明中的额外提示(以及Gem's Git的常见问题解答):http://www.developingandrails.com/2015/02/api -authentication与- devisetokenauth.html
我已停用Devise's:确认,但已激活:omniauthable.一切似乎都已到位,但我收到以下错误:
/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
Run Code Online (Sandbox Code Playgroud)
在我的用户模型中,我从以下代码开始:
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
Run Code Online (Sandbox Code Playgroud)
所以,:omniauthable似乎在那里.当我停用时:
include DeviseTokenAuth::Concerns::User
Run Code Online (Sandbox Code Playgroud)
然后一切都有效(但我需要它用于我的API身份验证).
关于我做错了什么的任何想法?