Devise 无法检测到:omniauthable,但它就在那里
Devise can't detect :omniauthable, but it's there
我有一个 RoR 应用程序,运行使用 Devise Gem 进行身份验证。对于我的新 API,我实施了 Gem "devise-token-auth":https://github.com/lynndylanhurley/devise_token_auth
因为我想为网站设计 运行 和 API 身份验证,所以我也遵循了以下说明中的额外提示(以及 Gem' 的常见问题解答s Git): http://www.developingandrails.com/2015/02/api-authentication-with-devisetokenauth.html
我停用了 Devise 的 :confirmable,但激活了 :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
在我的用户模型中,我从以下代码开始:
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
因此,:omniauthable 似乎在那里。当我停用时:
include DeviseTokenAuth::Concerns::User
然后一切正常(但我的 API 身份验证需要它)。
对我做错了什么有什么想法吗?
出于某种原因 include DeviseTokenAuth::Concerns::User
删除了 omniauthable
。
我解决了问题,将其添加回来:
devise :invitable, :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
:omniauthable
include DeviseTokenAuth::Concerns::User
devise :omniauthable
我有一个 RoR 应用程序,运行使用 Devise Gem 进行身份验证。对于我的新 API,我实施了 Gem "devise-token-auth":https://github.com/lynndylanhurley/devise_token_auth
因为我想为网站设计 运行 和 API 身份验证,所以我也遵循了以下说明中的额外提示(以及 Gem' 的常见问题解答s Git): http://www.developingandrails.com/2015/02/api-authentication-with-devisetokenauth.html
我停用了 Devise 的 :confirmable,但激活了 :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
在我的用户模型中,我从以下代码开始:
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
因此,:omniauthable 似乎在那里。当我停用时:
include DeviseTokenAuth::Concerns::User
然后一切正常(但我的 API 身份验证需要它)。
对我做错了什么有什么想法吗?
出于某种原因 include DeviseTokenAuth::Concerns::User
删除了 omniauthable
。
我解决了问题,将其添加回来:
devise :invitable, :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
:omniauthable
include DeviseTokenAuth::Concerns::User
devise :omniauthable