Hi everybody,
I’m new to auth0 so I figured I would start with the express quickstart guide to get started, and that’s working fine, I understand what it’s doing (or at least I think I do), and I’ve got my app running on localhost:3000 with and it works as expected.
The problem I’m having is trying to extend it further. What I’m attempting to do is to have it so that once a user finishes logging in they are redirected to localhost:3000/profile
Where I’m at right now is, I’ve got the “express-openid-connect” set up for the login page and the “express-oauth2-jwt-bearer” set up for JWT handling with the API.
My current code can be viewed on github here.
I’ve been googling around for a while and have tried a few different things, none of which seem to work, although this is probably more about me doing it wrong than the methods not working!
I’ve tried:
Using an Auth0 action
Adding in a post instruction for “/callback” because I can see after a login it makes a post to “/callback” and then a get to “/”
app.post('/callback', express.urlencoded({ extended: false }), (req, res) =>
res.oidc.callback({
redirectUri: 'http://localhost:3000/profile',
})
);
Adding a route to the config so that it reads:
const config = {
authRequired: false,
auth0Logout: true,
baseURL: 'http://localhost:3000',
clientID: 'CLIENT_ID',
issuerBaseURL: 'BASE_URL',
secret: 'SECRET',
routes: {
callback: '/profile'
}
}
No matter what I’ve tried it returns to “/” after the login is completed, nothing I do seems to make the post request actually trigger or do anything!
Can somebody please help me because I’m absolutely losing my mind on this!
What am I missing?
Thanks!