-
Notifications
You must be signed in to change notification settings - Fork 141
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
Add option to override transaction cookie name #414
Conversation
… clients on same protocol and domain.
Thanks for raising this @MatthewBacalakis! I know spa-js solves it this way, but I'd like to solve this by allowing the user to override the transaction cookie name themselves. Users can already set a custom session cookie name with We already have app.use(auth({ transactionCookie: { name: 'state.client1' } }));
app.use(auth({ transactionCookie: { name: 'state.client2' } })); |
Updated this so that the cookie can optionally be given any name instead of appending the client id. If transactionCookie.name is set in config that name is used. If not the current auth_verification name is used. |
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.
lgtm 👍
Could you also update the type defs https://github.com/auth0/express-openid-connect/blob/master/index.d.ts#L480
Something like
transactionCookie?: Pick<CookieConfigParams, 'sameSite'> & { name?: string };
This got released in 2.10.0 - thanks for your contribution @MatthewBacalakis! |
… clients on same protocol and domain.
The key("auth_verification") of the cookie storing nonce/state is problematic in cases where multiple applications share a common protocol and domain. In that case multiple concurrent logins can conflict with the login for one app clearing the auth_verification cookie intended for the other app. I recalled the SPA SDK used to have a similar problem and for this reason clientId was added to the key of the nonce/state storage.
To solve this the same way I've appended .CLIENT_ID to the key of the cookie storing nonce.