Skip to content
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

Conditionally redirecting to Auth0 Sign Up Page #135

Open
emily-foraged opened this issue Jan 23, 2024 · 3 comments
Open

Conditionally redirecting to Auth0 Sign Up Page #135

emily-foraged opened this issue Jan 23, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@emily-foraged
Copy link

Is there a way to have medusa-plugin-auth/Passport conditionally redirect users to the Auth0 sign up page rather than to the login page? It looks like if you pass ?screen_hint=signup to the Auth0 /authorize endpoint, users will be routed to the signup page (source). Unsure if there's a way to configure that query parameter within our Medusa app and pass it all the way through to the actual Auth0 url right now though.

@adrien2p
Copy link
Owner

I am not sure but open to investigation in order to see if we could do it.

@emily-foraged
Copy link
Author

Hey @adrien2p! I think I found a way to do this! I think we'd just need to replace the call to passport.authenticate on L79 in auth-routes-builder.ts with something like:

(req, res, next) => {
			const { screen_hint } = req.query;
			const authenticate = passport.authenticate(strategyName, {
				...passportAuthenticateMiddlewareOptions,
				session: false,
				screen_hint: screen_hint === 'signup' ? 'signup' : '',
			});
			authenticate(req, res, next);
}

I tried to push a branch to repo to open a PR but it seems to be stalling. I fond the contribution instructions but am not totally sure what they're asking of me - should I be forking the repo and opening a PR against the fork?

@adrien2p
Copy link
Owner

Sounds super cool, yes you need to and open a pr 👍

@adrien2p adrien2p added the enhancement New feature or request label Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants