https://supertokens.com/ logo
Title
c

Creepwood

12/21/2022, 6:59 PM
Hi, i am implementing SuperTokens EmailPassword recipe with react and python. But i have to use my own UI, because i need two different signups and everything in german. To my current problem: How do i work with the email verification. I toggle send email with "let response = await sendVerificationEmail(sessionContext);" and get an email with the correct token. How do i do the verify request? I found this method: "let response = await verifyEmail();" Anybody know how to use it?
n

nkshah2

12/22/2022, 4:28 AM
Hi
So it depends on how custom you want your implementation to be. If you are planning to use some of the components from the pre built UI you can continue to use the
supertokens-auth-react
SDK. If you want to build it entirely custom you should use the
supertokens-web-js
SDK.
Both SDKs have functions exposed from the individual recipes
Now for the email verification flow you want to do the following: 1. Trigger the verification email being sent to the user
EmailVerification.sendVerificationEmail()
This will trigger an email to the user, it will use the currently active session to determine the user's information 2. Verify the email on your frontend When the user clicks on the link in the email they will be redirected to your frontend with the verification token in the URL
EmailVerification.verifyEmail()
This will read the token from the URL and verify the user's email
c

Creepwood

12/22/2022, 1:02 PM
Hi, thanks for your fast reply. I got it to work. Seems that i was missing/loosing the query parameters with the token. After adding
const [searchParams, setSearchParams] = useSearchParams();
and
searchParams.forEach((key, value) => {params.push([key, value]);});
it worked. I was searching for a solution to pass the token to the
verifyEmail()
method... but than found in a changelog, that it was changed and now works automatically.
n

nkshah2

12/23/2022, 3:44 AM
Yep, when you call verifyEmail it will try to read from the URL on its own