function to get a email verification token. The input is a userId and email.
- Call the
VerifyEmailUsingToken
function with the generated token.
o
OhFlohre
04/03/2023, 11:52 AM
Okay thank you
r
rp_st
04/03/2023, 12:02 PM
This should be the code snippet:
Copy code
package main
import (
"github.com/supertokens/supertokens-golang/recipe/emailverification"
)
func manuallyVerifyEmail(userID string) error {
// Create an email verification token for the user
tokenRes, err := emailverification.CreateEmailVerificationToken(userID, nil)
if err != nil {
return err
}
// If the token creation is successful, use the token to verify the user's email
if tokenRes.OK != nil {
_, err := emailverification.VerifyEmailUsingToken(tokenRes.OK.Token)
if err != nil {
return err
}
}
return nil
}
SuperTokens is an open source authentication solution offering features like: Different types of login: Email / password, Passwordless (OTP or Magic link based).