Next.js Discord

Discord Forum

Next auth provider, handling errors while logging in

Unanswered
Cape horse mackerel posted this in #help-forum
Open in Discord
Cape horse mackerelOP
Hello guys.
I want to handle 4xx, 5xx errors given by provider(I'm using Okta provider with /userinfo endpoint) when trying to log in.
Right now when I try to login with some wrong credentials I'm stuck on the log in page and the url is /api/auth/signin?error=Callback. What I want to do is to check which errors are returned from the provider and show the user my /error/page.tsx , so if the error is 401 I should write smth like Not authorized and smth like that. Any idea?
Thanks in advance

0 Replies