devise_token_auth: 0.1.43 does not return client and access-token with each response
The latest version now wipes access-token and client for subsequent API requests:
# keep track of request duration
def set_request_start
@request_started_at = Time.zone.now
@used_auth_by_token = true
# initialize instance variables
@client_id = nil
@resource = nil
@token = nil
@is_batch_request = nil
end
The way we had our application set up was relying on those access tokens being returned as they were in previous releases.
Why was this change added? The commit only mentions passing tests: https://github.com/lynndylanhurley/devise_token_auth/commit/bdcd05e284e7fd0774005248a3239bfc889824c4
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 5
- Comments: 29 (14 by maintainers)
Commits related to this issue
- Only persist incoming auth headers if the 'access-token' is truthy This is a temporary (?) solution before https://github.com/lynndylanhurley/devise_token_auth/pull/703 is rolled back. Once https://... — committed to riboseinc/j-toker by ribose-jeffreylau 6 years ago
- Only persist incoming auth headers if the 'access-token' is truthy This is a temporary (?) solution before https://github.com/lynndylanhurley/devise_token_auth/pull/703 is rolled back. Once https://... — committed to riboseinc/j-toker by ribose-jeffreylau 6 years ago
Since the update was shipped the client only got a new
access-tokenwhen the usedaccess-tokenwas expired. So even when I used theaccess-token100 times in a row (batched) i get no newaccess-token.When the client waits for 5 seconds (default) the next response will give me a new
access-token. The Problem here is that used and expired tokens are still valid to use a last time for 2 weeks (default) instead of only 5 seconds (normally you have to use the next access-token from the response here)Before the 1.43 update the
access-tokenwas only valid for 2 weeks when it was not used before. And the client got a newaccess-tokenfor every request it makes.This is a breaking change for sure.
Workaround for clients: if you have a client check if your request gives you an empty
access-token. If its empty your old token is still valid and not expired so you can use it for the next query. When youraccess-tokenis expired, your next (and last possible query with that access-token) will give you the next validaccess-tokenAs a workaround for now, we’re going to update the
nillines to the following: