Skip to content

Commit 387306a

Browse files
authored
Issue - 1358 Argument error when converting token updated_at using to_time fixed (lynndylanhurley#1388)
1 parent a3595f4 commit 387306a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

app/models/devise_token_auth/concerns/user.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def create_new_auth_token(client = nil)
158158
token = create_token(
159159
client: client,
160160
last_token: tokens.fetch(client, {})['token'],
161-
updated_at: now
161+
updated_at: now.to_s(:rfc822)
162162
)
163163

164164
update_auth_header(token.token, token.client)
@@ -194,7 +194,7 @@ def build_auth_url(base_url, args)
194194
end
195195

196196
def extend_batch_buffer(token, client)
197-
tokens[client]['updated_at'] = Time.zone.now
197+
tokens[client]['updated_at'] = Time.zone.now.to_s(:rfc822)
198198
update_auth_header(token, client)
199199
end
200200

test/test_helper.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class ActiveSupport::TestCase
4646

4747
def age_token(user, client_id)
4848
if user.tokens[client_id]
49-
user.tokens[client_id]['updated_at'] = Time.zone.now - (DeviseTokenAuth.batch_request_buffer_throttle + 10.seconds)
49+
user.tokens[client_id]['updated_at'] = (Time.zone.now - (DeviseTokenAuth.batch_request_buffer_throttle + 10.seconds)).to_s(:rfc822)
5050
user.save!
5151
end
5252
end

0 commit comments

Comments
 (0)