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

Store expiry correctly #62

Merged
merged 2 commits into from
Sep 9, 2024
Merged

Store expiry correctly #62

merged 2 commits into from
Sep 9, 2024

Conversation

mkangia
Copy link
Contributor

@mkangia mkangia commented Sep 7, 2024

This turns out to be the core of the issue/misunderstanding that we have been seeing.

When we modified the value for expiry to 0 it didn't really take effect.
The token that was sent back in response to HQ, is the one that was passed to the function save_token and is expected to be stored as it is, though we were modifying it here which would lead to a mismatch in what HQ was told about the token and what we stored. So, a token even if valid according to HQ could be expired as per CommCareAnalytics or vice versa.
This didn't cause any mismatch back then because it set the default value of 1 day which was also the value set for expiry for the token. And HQ was requesting a new token for every request anyway.

But then we modified it to 0 or 10 which was different from what HQ had for the token.
So, when HQ was updated to reuse token here, it would get a 401 instead when we modified the value for token expiry to anything other than 1 day, and it was set to 10 seconds recently.

I have added an example of how to correctly override the expiry time.

We can consider adding back revoking tokens, 4c73ffd

store the same expires_in in DB as it will returned to the client in response
@mkangia mkangia force-pushed the mk/set-expiry-correctly branch from bb681c1 to 199f8ef Compare September 8, 2024 16:18
@mkangia mkangia changed the title Set expiry correctly and update it to 1 hour Store expiry correctly Sep 8, 2024
@mkangia mkangia requested a review from kaapstorm September 9, 2024 11:14
@mkangia mkangia merged commit 81ada91 into master Sep 9, 2024
3 checks passed
@mkangia mkangia deleted the mk/set-expiry-correctly branch September 9, 2024 12:52
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

Successfully merging this pull request may close these issues.

2 participants