Rails中的设计和无状态令牌 [英] Devise and Stateless tokens in Rails
问题描述
我听说过一个名为stateless_token(boolean)的设置,但是我无法弄清楚哪里放这个设置。有没有另一种方法?
如果在这里找到token_authenticatable:
https://github.com/plataformatec/devise/blob/master/lib/devise/strategies /token_authenticatable.rb
如果在这里找到有关stateless_token的信息:
http://rdoc.info/github/plataformatec/devise/master/Devise/Models/ TokenAuthenticatable
stateless_token
现在已被弃用。这是新形式(它允许更多的认证策略成为无状态):
#config / initializers / devise.rb
config.skip_session_storage = [:token_auth]
I got an API that I have developed using Rails 3 and Devise. I am using tokens (token_authenticatable) for authentication for requests made to the API from a client. I want to be able to switch between users in the requests just be replacing the token.
I heard about a setting called :stateless_token (boolean) but I cannot figure out where to put this setting. Is there another way?
If found the token_authenticatable here:
https://github.com/plataformatec/devise/blob/master/lib/devise/strategies/token_authenticatable.rb
If found info about the stateless_token here:
http://rdoc.info/github/plataformatec/devise/master/Devise/Models/TokenAuthenticatable
stateless_token
is deprecated as of now. This is the new form (it allows more auth strategies to be stateless):
# config/initializers/devise.rb
config.skip_session_storage = [:token_auth]
这篇关于Rails中的设计和无状态令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!