-
Notifications
You must be signed in to change notification settings - Fork 152
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Checklist
- The issue can be reproduced in the express-openid-connect sample app (or N/A).
- I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
- I have looked into the API documentation and have not found a suitable solution or answer.
- I have searched the issues and have not found a suitable solution or answer.
- I have searched the Auth0 Community forums and have not found a suitable solution or answer.
- I agree to the terms within the Auth0 Code of Conduct.
Description
I have multiple apps using the same domain with the same login system (Cognito). When navigating directly to a page, there are no issues. However, if I navigate to the first page, then go to the second page, and finally click the browser's back button to return to the first page, I always encounter a BadRequestError.
BadRequestError: checks.state argument is missing
at ResponseContext.callback (/home/node_modules/express-openid-connect/lib/context.js:354:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
It only happens on v2 express-openid-connect, but not on v1.
App using v2 is able to return to app using v1 without issue using browser's back button. Somehow it only happens in v2.
Is it the desired behavior or am I overlooking something? Thank you for your time.
Reproduction
- Login to the portal
- Route to the first page
- Route to the second page
- Click browser's back button to return to the first page.
- Error shows up
One of the apps setup:
server.use(
auth({
authRequired: true,
issuerBaseURL: `https://cognito-idp.us-east-1.amazonaws.com/${process.env.USER_POOL_ID}`,
baseURL,
clientID: `${process.env.COGNITO_CLIENT_ID}`,
clientSecret: `${process.env.COGNITO_CLIENT_SECRET}`,
secret,
authorizationParams: {
response_type: "code",
scope: "openid profile",
},
routes: {
postLogoutRedirect: `https://${process.env.COGNITO_USER_POOL_DOMAIN}/logout?client_id=${process.env.COGNITO_CLIENT_ID}&logout_uri=${baseUrl}`,
},
afterCallback: async function (req, res, session, decodedState) {
try {
return session;
} catch (err) {
console.error(
"There was a problem after auth callback: ",
err
);
return session;
}
},
})
);
Additional context
No response
express-openid-connect version
2.17.1
Express version
4.18.2
Node.js version
16
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working