Skip to content

couldn't handle custom error from authorize in frontend, using Vite, React and Hono.js #12495

Answered by QingjiaTsang
QingjiaTsang asked this question in Help
Discussion options

You must be logged in to vote

Here for someone using pure React and coming up with the same problem:

I write my own sign-in endpoint for handling the custom error which is not so supported by authjs when it comes to just use React instead of Nextjs.
Check out the code below. This is mainly what the endpoint handler does, and it basically just verifies the user and inserts the session to the db by ourselves. Maybe you would wonder how it works; it's pretty easy. Just check out the network section in the devtools, you'll see the auth.js always sending requests to /api/auth/session to see if we signed in. Under the hood, it just queries the db to verify the seesion. You can go deep into the source code of authjs to check…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by QingjiaTsang
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
bug Something isn't working triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
2 participants
Converted from issue

This discussion was converted from issue #12479 on January 12, 2025 07:09.