Hi,
I’m building an application with:
- Frontend: React + Vite (localhost:5173)
- Backend: Express.js (localhost:3000)
- Auth0: Regular web app, using the dependancy “express-openid-connect”
My Auth0 configuration in the backend is:
const config = {
authRequired: false,
auth0Logout: true,
secret: process.env.AUTH0_SECRET,
baseURL: 'http://localhost:3000',
clientID: process.env.AUTH0_CLIENT_ID,
issuerBaseURL: process.env.AUTH0_DOMAIN,
}
app.use(auth(config));
Currently, after login, Auth0 sends me to the callback (/callback
) and then automatically redirects to the baseURL
(http://localhost:3000/
).
What I want is instead of sending me to /
, to redirect me to another endpoint in my backend.
http://localhost:3000/auth/session
so I can create the user in my mongodb, generate access token and refresh token.
How can I make Auth0 automatically redirect to http://localhost:3000/auth/session
after the callback instead of going to the baseURL
?