-
Couldn't load subscription status.
- Fork 154
Add support for MRRT #704
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
base: master
Are you sure you want to change the base?
Add support for MRRT #704
Conversation
f5fb9f6 to
68868e6
Compare
68868e6 to
5126d4a
Compare
| findCompatibleActive(tokenSets, authorizationParams) { | ||
| return tokenSets.find( | ||
| (ts) => | ||
| !TokenSetUtils.isExpired(ts) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these 3 methods findCompatibleActive, findCompatibleExpired findCompatibleRefreshable looks similar. Could we refactor this?
|
|
||
| /** @type {import('..').TokenSetParameters | undefined} */ | ||
| let found; | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we consider the most recent token? Could you re-check this once.
| * small enough that a token can't possibly fit inside. | ||
| */ | ||
| const loggedOutCookies = await context.cookies(); | ||
| assert.isTrue(loggedOutCookies.find(({ name }) => name === 'appSession').size < 200); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here if loggedOutCookies.find does find the cookie it returns undefined
Shall we do something
const appSessionCookie = loggedOutCookies.find(({ name }) => name === 'appSession'); assert.isTrue(!appSessionCookie || appSessionCookie.size < 200);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is fixed now here. Some code was not expecting the possibility of optional props to actually be present in the tokenset but with a nullish value. This caused the cookie not to be properly cleared.
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
Description
This PR adds support for Auth0's MRRT feature.
High-level overview of the changes this PR includes:
Aand I need a token for audienceB, I can do a refresh fromAtoB). Can be enabled with the newtokenHistoryoption, but it's disabled by default.authorizationParamsargument that will override the one set at the SDK level. This is not a breaking change since I included a compatibility layer that detects old vs. new arguments and normalizes them (seerequiresAuthLegacyArgs.js).useMrrtoption, to enable the potential usage of MRRT, depending on whatever it's in the token history. It requirestokenHistoryto be enabled and proper configuration in Auth0. Disabled by default.autoRefreshExpiredoption, to improve the DX when using MRRT. This way, requesting a series of tokens with different audiences/scopes to protect a route is a declarative operation, instead of having to check whether tokens are expired.Testing
Checklist