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

#5691 Refresh id token if it expires #5731

Merged
merged 4 commits into from
May 31, 2024

Conversation

ioanmo226
Copy link
Collaborator

@ioanmo226 ioanmo226 commented May 23, 2024

This PR implemented logic to refresh id token if it expires

close #5691 // if this PR closes an issue


Tests (delete all except exactly one):

  • Does not need tests (refactor only, docs or internal changes)

To be filled by reviewers

I have reviewed that this PR... (tick whichever items you personally focused on during this review):

  • addresses the issue it closes (if any)
  • code is readable and understandable
  • is accompanied with tests, or tests are not needed
  • is free of vulnerabilities
  • is documented clearly and usefully, or doesn't need documentation

@ioanmo226 ioanmo226 marked this pull request as ready for review May 29, 2024 08:09
@ioanmo226 ioanmo226 requested a review from sosnovsky as a code owner May 29, 2024 08:09
Copy link
Collaborator

@sosnovsky sosnovsky left a comment

Choose a reason for hiding this comment

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

let's also add test for this situation when id token is expired - I think we already have mock function for generating id token. so test should be like this:

  • generate id token with 5 seconds expiration
  • wait for 5 seconds
  • try to perform request to external service
  • check if id token was refreshed and request succeeded

extension/js/common/api/shared/api.ts Show resolved Hide resolved
Copy link
Collaborator

@sosnovsky sosnovsky left a comment

Choose a reason for hiding this comment

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

Yeah, seems like there is no easy way to make it work for all api calls without using service worker. So let's try this solution.
There is an existing issue for adding ui test - #4954

@sosnovsky sosnovsky merged commit 9a3ba05 into master May 31, 2024
13 checks passed
@sosnovsky sosnovsky deleted the 5691-check-google-id-token-expiration-before-usage branch May 31, 2024 19:58
ioanmo226 added a commit that referenced this pull request Jun 3, 2024
* feat: added token refresh logic when 401 error occurs

* fix: circular dependency injection error
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.

Check Google id token expiration before usage
2 participants