NextJS: How do I set password for a user that was invited by email
Hi, everyone.
I'm running a Next App with app router, and it will only allow users that has been invited by email - no signups. I've managed to create a route that actually reads the hash_token and type. I then also redirect the user to a (server side)
set-password
set-password
page, where I have a (client) form component. So far, so good.
Now, I need to somehow let the user set a password. I1m not sure how to do this. I would like to do this on the server (server component + action, if possible.
In the docs I can find two different methods;
updateUser
updateUser
and under "Auth Admin" the
updateUserById
updateUserById
.
Could anyone explain to me the best way of doing this?
Also, what is the best practice in a situation like this? As far as I understand, and can see in my Supabase Dashboard, the invited user is "signed in" at the moment he is at the "Set password" page. I should probably hide the navbar at this point, so that he has to set his password?
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.