Back

Verify user react

  • 0
  • Users
  • Web
D5
27 May, 2023, 20:39

Response to: https://discord.com/channels/564160730845151244/564160731327758347/1112109101934194748

About how to make verificate an user (react app)

TL;DR
To verify a user in a React app, you will need to follow these steps: 1. After loading the page, retrieve the `USER_ID` and `SECRET` from the URL. 2. Use the `account.updateVerification()` function with the `USER_ID` and `SECRET` variables to execute the code. 3. Make sure to replace `[USER_ID]` and `[SECRET]` with the actual `USER_ID` and `SECRET` values. 4. On the mentioned URL (`example.com`), set up a redirect URL for the user to complete the verification. 5. Trigger the verification process by using the `account
D5
27 May, 2023, 20:39

@Sanchit Bajaj I'm answering here

D5
27 May, 2023, 20:41

In this part, you firstly need to trigger (for example after creating an account with a button) this:

TypeScript
const promise = account.createVerification('https://example.com');
D5
27 May, 2023, 20:42

In the example.com URL you need to setup an URL for redirecting user to a page that you have made in order to complete the verification

D5
27 May, 2023, 20:43

After that, in this second URL, you can see the code that the end page needs to verify the user

D5
27 May, 2023, 20:44

In other words, the URL I mentioned before (example.com)

D5
27 May, 2023, 20:46

After loading the page, you will need to get USER_ID from URL and SECRET. Once you have got it and you have a variable with them, add this code to be executed:

TypeScript
const promise = account.updateVerification('[USER_ID]', '[SECRET]');

You will need to put in the mentioned places both userID and Secret

D5
27 May, 2023, 20:47

@Sanchit Bajaj Hope that's helpful, if not, tell me and I will search more examples, etc

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more