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

Custom Login Page Error Handling? #1192

Closed
Lightgaming opened this issue Jan 24, 2021 · 6 comments
Closed

Custom Login Page Error Handling? #1192

Lightgaming opened this issue Jan 24, 2021 · 6 comments
Labels
duplicate This issue or pull request already exists help needed The maintainer needs help due to time constraint/missing knowledge question Ask how to do something or how something works

Comments

@Lightgaming
Copy link

I have a custom login page that uses the signIn method (LDAP Credential Provider) which works perfectly.
When the wrong credentials are entered the user is redirected to an Error page, which I don't want.
I don't want this error redirect.
image

Is there a way to use the signIn method like this?:

image

Or maybe something similar, so I can handle the error myself?

@Lightgaming Lightgaming added the question Ask how to do something or how something works label Jan 24, 2021
@balazsorban44
Copy link
Member

balazsorban44 commented Jan 24, 2021

You could try creating a custom error page as well? you will receive the type of error as a query parameter to handle the different cases.

Here is a list of all the pages you can override:
https://next-auth.js.org/configuration/pages

@Lightgaming
Copy link
Author

I could do that, this would solve my redirect problem since it's just a route, but how would I get the error message back in my React Login component?

I want it that way: When the user clicks login and the creds are wrong I get the error in my React Logic and show some nicely formatted error message in the form, so the user knows what's wrong

@balazsorban44 balazsorban44 added the help needed The maintainer needs help due to time constraint/missing knowledge label Jan 25, 2021
@balazsorban44
Copy link
Member

balazsorban44 commented Jan 25, 2021

Duplicate of #989. Going to close this in favor of the other one. Feel free to continue there. 🙂

@balazsorban44
Copy link
Member

@Lightgaming follow #1219 😉

@Taha-mlaiki
Copy link

@Lightgaming did you resolve your problem , because I'm facing it to right now
??

@Lightgaming
Copy link
Author

@Taha-mlaiki unfortunately I don't really know. It was a school project and I don't have access to the code anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists help needed The maintainer needs help due to time constraint/missing knowledge question Ask how to do something or how something works
Projects
None yet
Development

No branches or pull requests

3 participants