module Devise::Models::AccessTokenAuthenticatable

Public Instance Methods

after_token_authentication(token) click to toggle source
# File lib/devise/models/access_token_authenticatable.rb, line 32
def after_token_authentication(token)
  token.used!
end
authentication_token() click to toggle source
# File lib/devise/models/access_token_authenticatable.rb, line 28
def authentication_token
  access_token.try(:token)
end
ensure_authentication_token!() click to toggle source
# File lib/devise/models/access_token_authenticatable.rb, line 17
def ensure_authentication_token!
  set_authentication_token! unless access_token
end
invalidate_authentication_token!() click to toggle source
# File lib/devise/models/access_token_authenticatable.rb, line 8
def invalidate_authentication_token!
  access_token.invalidate! if access_token
end
reset_authentication_token!() click to toggle source

TODO Remove this entirely. A user should be able to have many access tokens, that should expire after a period of time.

# File lib/devise/models/access_token_authenticatable.rb, line 23
def reset_authentication_token!
  invalidate_authentication_token!
  set_authentication_token!
end
set_authentication_token!() click to toggle source
# File lib/devise/models/access_token_authenticatable.rb, line 12
def set_authentication_token!
  self.access_token = access_tokens.create!
  save(:validate => false)
end