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

PIA-1882: Refresh Auth tokens if needed on every request #35

Merged

Conversation

kp-laura-sempere
Copy link
Collaborator

  • The Network client will make a call to check whether the auth tokens should be refreshed before performing a request if the configuration has the property refreshAuthTokensIfNeeded enabled -> this gives us the flexibility to execute requests with and without refreshing tokens

  • The RefreshAuthTokensChecker will check the expiration date of both the api and vpn tokens. And it will refresh them only if they are going to expire in less than 30 days. Note: we can adjust this number of days as we think is reasonable.

Copy link
Contributor

@kp-juan-docal kp-juan-docal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor question. Looking good!

if let error {
completion(error)
} else {
completion(nil)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: wouldn't this one line completion(error) achieve the same given that its parameter is either an error object or null? And if that's the case, we might not need the method altogether 🤔

Copy link
Collaborator Author

@kp-laura-sempere kp-laura-sempere May 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, absolutely , you're right 👍
Let me update it, thanks!

@kp-laura-sempere kp-laura-sempere merged commit 003c1ae into master May 31, 2024
1 check passed
@kp-laura-sempere kp-laura-sempere deleted the PIA-1882_execute_tokens_check_on_all_api_calls branch May 31, 2024 08:10
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