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

[FIX] includeExpired set to false should not automatically return null #397

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rafaelsorto
Copy link

includeExpired set to false is incorrectly forcing the loadOfflineSession method to always return null. Offline sessions should not be considered invalid automatically if they don't have an expiration date and the property should be used in the valid check to discard expired sessions.

WHY are these changes introduced?

  • Bug not reported for this issue. Identified on production.

  • Offline sessions not used even when they exist and token is valid

WHAT is this pull request doing?

  • It fixes the incorrect checks for a Offline Session

Type of change

  • Patch: Bug (non-breaking change which fixes an issue)
  • Minor: New feature (non-breaking change which adds functionality)
  • Major: Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • I have added a changelog entry, prefixed by the type of change noted above
  • I have added/updated tests for this change
  • I have updated the documentation for public APIs from the library (if applicable)

@rafaelsorto
Copy link
Author

I have signed the CLA!

@Arkham
Copy link
Contributor

Arkham commented Feb 3, 2025

hey @rafaelsorto, thanks for your contribution. Could you please add a test?

@rafaelsorto
Copy link
Author

hey @rafaelsorto, thanks for your contribution. Could you please add a test?

Hey @Arkham I see that the tests are passing even with the previous code and also pass with my changes. Looking further into this it seems the only change is that isValid is not actually checked if you pass includeExpired set to true which misses the checks for a valid access_token and a valid scope.

The default includeExpired check for a valid token, but the validity check does 3 things at once, checks the scope, checks the access_token and checks the date, includeExpired set to true avoids the expiration check but also avoids the other 2 checks at the same time.

@Arkham
Copy link
Contributor

Arkham commented Feb 4, 2025

Yeah, what I'm suggesting is that you add a new test that would fail with the existing code, then it should pass when we change the implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants