react-netlify-identity
react-netlify-identity copied to clipboard
How to confirm user newly signed up?
In [gotrue-js] to confirm a user you have to take the user token and call:
auth.confirm(token, remember)
How do you do this in this library?
@dorelljames This should happen automatically with this library if you are using the context provider or hook. The runRoutes.tsx
file parses the URL for a hash matching confirmation_token
and calls the GoTrue instance's confirm
method with the token found in the URL.
You can try this in a local development environment by using the signupUser
function provided by the useIdentityContext
with an email you control. Netlify should send a confirmation email to the email address you provided. Click on the link and it will navigate to YOUR_NETLIFY_URL/#confirmation_token=TOKEN
. If you replace YOUR_NETLIFY_URL
with the address of your locally hosted application (e.g. localhost:3000/
) and load that URL in your browser, you should see that you are now logged in as that user.
Please let me know if this didn't answer your question or solve your problem and I can investigate more!
this seems now to be broken? im receiving a 422 response when visiting the confirm address.... any ideas?
{"code":422,"msg":"Invited users must specify a password"}
@dorelljames This should happen automatically with this library if you are using the context provider or hook. The
runRoutes.tsx
file parses the URL for a hash matchingconfirmation_token
and calls the GoTrue instance'sconfirm
method with the token found in the URL.You can try this in a local development environment by using the
signupUser
function provided by theuseIdentityContext
with an email you control. Netlify should send a confirmation email to the email address you provided. Click on the link and it will navigate toYOUR_NETLIFY_URL/#confirmation_token=TOKEN
. If you replaceYOUR_NETLIFY_URL
with the address of your locally hosted application (e.g.localhost:3000/
) and load that URL in your browser, you should see that you are now logged in as that user.Please let me know if this didn't answer your question or solve your problem and I can investigate more!
This no longer works it seems. I tried it on the live site and locally replacing the domain with the local domain but either way it did not log me in after visiting the link and it did not confirm the email address because when I try to login manually afterward it tells me that the email address has not been confirmed.