email activation using jsonwebtoken
Unanswered
Schweizer Laufhund posted this in #help-forum
Schweizer LaufhundOP
I have an authentication system using next-auth and the CredentialsProvider, basically when I register, an email is sent to verify the supplied email address is real. When the user clicks the link in the email, it should redirect to a page route in my app, which then uses reads the jsonwebtoken from the URL path, then will activate the user's account based on this token's info. However, my route is not being recognized, I get a 404, This page could not be found with the URL
http://localhost:3000/activate/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY0YmVlYWQwNTdhMzQ4MTdhNWEzNjFlMiIsImlhdCI6MTY5MDIzMzU1MywiZXhwIjoxNjkwNDA2MzUzfQ.Dd123pMTpG6Itg9swT8VSLQqRjjBdhi5y4vK9LGkgP4
Now, you can see there are 2 periods (.) in this URL, it is those that are causing trouble, if I remove everything after the first period inclusively, then the route is matched, so it appears that a
* Force jsonwebtoken library to only use certain characters (not even sure if that is possible, but I'm looking into it)
* Fix my code so that this dynamic route is matched
My route as it stands is
Any guidance is greatly appreciated, thanks in advance
Mark
http://localhost:3000/activate/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY0YmVlYWQwNTdhMzQ4MTdhNWEzNjFlMiIsImlhdCI6MTY5MDIzMzU1MywiZXhwIjoxNjkwNDA2MzUzfQ.Dd123pMTpG6Itg9swT8VSLQqRjjBdhi5y4vK9LGkgP4
Now, you can see there are 2 periods (.) in this URL, it is those that are causing trouble, if I remove everything after the first period inclusively, then the route is matched, so it appears that a
. is not a value I can use. I can see 2 options, neither are clear to me how to manage though:* Force jsonwebtoken library to only use certain characters (not even sure if that is possible, but I'm looking into it)
* Fix my code so that this dynamic route is matched
My route as it stands is
src/app/activate/[id]/page.tsx, I expected the [id] bit to capture the entire jsonwebtoken, but am obviously wrong in this assumption.Any guidance is greatly appreciated, thanks in advance
Mark