Swish2121
Swish2121

Reputation: 97

Devise Reset Authentication Token

I am using Devise and I have an authentication_token that I pass in the header of my API calls

How do I reset that token when the user logs out?

I want a new token generated every time they are logging in.

Upvotes: 0

Views: 894

Answers (1)

Antarr Byrd
Antarr Byrd

Reputation: 26169

You can try using the after_database_authentication callback on the model.

def after_database_authentication
  self.update_attribute(:auth_token, generated_token)
end

def generated_token
   ...
end

Upvotes: 1

Related Questions