Hi Auth0, I’ve read most everything you can both on Auth0 site, other forum posts and github. I tried a good part of yesterday to have my signup button redirect to the signup page instead of login but still haven’t gotten it.
I followed and have the login page working well from the NodeJS quick start:
Backend:
const { auth } = require('express-openid-connect');
const config = {
authRequired: false,
auth0Logout: true,
secret: 'a long, randomly-generated string stored in env',
baseURL: 'http://localhost:3000',
clientID: 'ABCDEJGHIJKLMNOP',
issuerBaseURL: 'https://dev-9l7-li-e.us.auth0.com'
};
// auth router attaches /login, /logout, and /callback routes to the baseURL
app.use(auth(config));
// req.isAuthenticated is provided from the auth router
app.get('/', (req, res) => {
res.send(req.oidc.isAuthenticated() ? 'Logged in' : 'Logged out');
});
Now here are the problem children:
Frontend using react to call API:
<div class="dropdown-menu">
<a href = 'http://localhost:8080/signup' >
<span>Sign up</span>
</a>
<a href = 'http://localhost:8080/signin' >
<span>Sign in</span>
</a>
</div>
Corresponding backend:
app.get('/signin', (req, res) => {
var user = JSON.stringify(req.oidc.user.nickname);
res.send(req.oidc.isAuthenticated() ? res.redirect(`http://localhost:3000/${user}`) : console.log('Logged out')) ;
});
app.get('/signup', (req, res) => {
var user = JSON.stringify(req.oidc.user.nickname);
res.send(req.oidc.login({
extraOptions: {
screen_hint: 'signup',
},
}) ? res.redirect(`http://localhost:3000/${user}`) : console.log('Logged out')) ;
});
Both sign in and signup ‘get’ calls redirect to the login page, and I have tried countless permutations of screen_hint = signup (including things like ‘screen_hint’ : ‘signup’ and countless other similar tries). I see this is a parameter, and in my provided backend code you can see what I ended with, but I tried putting this parameter in the config section, and also as otherParameters, Parameters, params instead of extraOptions which was my last try before seeking additional help.
Thank you guys, I spent a long while on this and was hoping you’d be able to help ASAP
Best,
-Mike