[Issue]: Redirect banned user to a custom page after login in with OAuth (Google)

Problem:
Here is what I'm getting after trying to login as a "banned" user using OAuth (Google).

http://localhost:3000/api/auth/error?error=banned&error_description=You%20have%20been%20banned%20from%20this%20application.%20Please%20contact%20support%20if%20you%20believe%20this%20is%20an%20error

Current workaround:
  hooks: {
    before: createAuthMiddleware(async (ctx) => {
      if (ctx.path === "/error") {
        if (ctx.query && "error" in ctx.query && ctx.query.error === "banned") {
          throw ctx.redirect(`/banned`);
        }
      }
    }),
  },


I'm on the latest version of better-auth (v1.2.10)
I found those issues to be related #1580 #1282

Those issues already exist I didn't want to open a new issue, but I need help with how to handle things correctly with the current version of better-auth.
I’d appreciate guidance on the proper way to handle this in v1.2.10, especially with user context preserved.

Limitations:
  1. banned page doesn't have any context about banned user
  2. if I want to show the banReason I can't.
  3. if I want to show a countdown timer I can't
Request:
I'd appreciate taking another look at those issues mentioned above
458543241-d6b58cc6-ad8f-49b6-958c-012e618d6bce.png
GitHub
Is this suited for github? #1581 To Reproduce most probably this is due to callback api route and in my case code is not generated as i cancel the process to choose another account logger do print ...
GitHub
Is this suited for github? Yes, this is suited for github Is your feature request related to a problem? Please describe. I want to customize the response when a banned user tries to login. currentl...
Was this page helpful?