Module: Devise::Models::TokenAuthenticatable::ClassMethods

Defined in:
lib/devise/models/token_authenticatable.rb

Instance Method Summary collapse

Instance Method Details

#authenticate_with_token(attributes) ⇒ Object

Authenticate a user based on authentication token.



59
60
61
62
63
# File 'lib/devise/models/token_authenticatable.rb', line 59

def authenticate_with_token(attributes)
  token = attributes[self.token_authentication_key]
  resource = self.find_for_token_authentication(token)
  resource if resource.try(:valid_authentication_token?, token)
end

#authentication_tokenObject



65
66
67
# File 'lib/devise/models/token_authenticatable.rb', line 65

def authentication_token
  ::Devise.friendly_token
end