Skip to content

Provider Oauth Login Cancel Callback #7407

@Hyodori04

Description

@Hyodori04

Question 💬

I am using next-auth for login. When I use provider oauth login (ex : discord), cancel of discord login redirect to (/api/auth/signin?error=Callback). But considering user experience, it is good to redirect origin url. So I wonder why OAUTH_CALLBACK_HANDLER_ERROR redirect to signin error page. And OAUTH_CALLBACK_HANDLER_ERROR is related to another error excepting Cancel. If not I want to add some options in provider that go back to origin url if user just cancel Oauth login

How to reproduce ☕️

related next-auth code

 if ((error as Error).name === "AccountNotLinkedError") {
          // If the email on the account is already linked, but not with this OAuth account
          return {
            redirect: `${url}/error?error=OAuthAccountNotLinked`,
            cookies,
          }
        } else if ((error as Error).name === "CreateUserError") {
          return { redirect: `${url}/error?error=OAuthCreateAccount`, cookies }
        }
        logger.error("OAUTH_CALLBACK_HANDLER_ERROR", error as Error)
        return { redirect: `${url}/error?error=Callback`, cookies }

Contributing 🙌🏽

Yes, I am willing to help answer this question in a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionAsk how to do something or how something works

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions