Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expiration not working #57

Open
prcongithub opened this issue Feb 20, 2023 · 2 comments
Open

Expiration not working #57

prcongithub opened this issue Feb 20, 2023 · 2 comments

Comments

@prcongithub
Copy link

if Time.now > (resource.authentication_token_created_at + token_expires_in.to_i)

Devise::TokenAuthenticatable.setup do |config|
  config.token_expires_in = 90.days
end
irb(main):019:0> resource = User.last
=> #<User _id: BSON::ObjectId('63906c700f1a26001eae45dd'), access_tokens: ["qoUUnr0aeSX1Pc8gE6TD1VQ8w6V3RJBf"], activated_at: Wed, 07 Dec 2022 10:35:28 +0000, ac...
irb(main):020:0> resource.authentication_token_created_at = Time.now-100.days
=> 2022-11-12 06:18:34.494768917 +0000
irb(main):021:0> resource.save!
=> true
irb(main):022:0> resource.token_expires_in
=> 90 days
irb(main):023:0> resource.authentication_token_created_at
=> Sat, 12 Nov 2022 06:18:34 +0000
irb(main):024:0> Time.now > (resource.authentication_token_created_at + resource.token_expires_in.to_i)
=> false
irb(main):025:0> Time.now
=> 2023-02-20 06:19:16.49710795 +0000
irb(main):026:0> Time.now > (resource.authentication_token_created_at + resource.token_expires_in)
=> true
irb(main):027:0>

Am I missing something?

Version: 1.1.0

@prcongithub
Copy link
Author

#58 #58

@baschtl
Copy link
Owner

baschtl commented Jun 26, 2024

@prcongithub I did not follow changes in Ruby or Devise for a long time. Is this a change that happened in devise? Can you explain why this worked before? Which devise versions is this compatible with?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants