Skip to content

v4: Customize auth handlers #1895

@mvvmm

Description

@mvvmm

Checklist

  • I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
  • I have looked into the API documentation and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.

Describe the problem you'd like to have solved

In v3, we could customize the auth handlers in /api/auth/[auth0] via something like:

export const GET = handleAuth({
  async logout(req: NextApiRequest, res: NextApiResponse) {

   // do custom stuff

   return await handleLogout(req, res);
  },
});

Reference:

I'm not finding that something similar exists in v4.

Describe the ideal solution

Ability to customize the auth handlers in v4.

The handleLogout() helper is an important piece of this. We need the ability to write our own custom code and then rely on the default auth handler as a fallback, or in addition to our custom code.

Alternatives and current workarounds

Depends on the use case, but as far as I can tell, there is no way to run custom code in the middle of those new auth handlers, /auth/logout, for example.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions