Open koddek opened 1 year ago
Hi, you can add a method to your project to send an activation email to the email address after Signing Up . When Signing in, FirebaseAuthClient has a method to verify if the user has activated their email with:
var userInfo = FirebaseAuthHelper.GetUserInfo(Your FirebaseAuthClient);
bool flag = userInfo.IsEmailVerified;
if(flag)
{
//if email is verified
}
A method that can send a verification email to a signed up email address:
using System.Net.Http.Headers;
private const string FirebaseApiKey = "Your API KEY;
private const string RequestUri = "https://identitytoolkit.googleapis.com/v1/accounts:sendOobCode?key=" + FirebaseApiKey;
public static async Task SendVerificationEmailAsync(string USER TOKEN)
{
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
var content = new StringContent("{\"requestType\":\"VERIFY_EMAIL\",\"idToken\":\"" + idToken + "\"}");
content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
var response = await client.PostAsync(RequestUri, content);
response.EnsureSuccessStatusCode();
}
}
Ok so I am attempting to implement Email Verification to this project. So far I have the REST url, and some classes:
Where do I go from here? I would like to have a method in the FirebaseAuthClient class that says VerifyEmail(email), where an email is sent to the provided email address with a link that verifies the user when they click on it.