首页 > 解决方案 > Xamarin Firebase 发送电子邮件验证

问题描述

美好的一天,注册帐户后如何在 Xamarin 上发送电子邮件验证我正在使用此代码,但sendEmailVerification其中说 FirebaseAuth 没有定义sendEmailVerification

我怎样才能解决这个问题?

private void LoginUser(string email, string password){

   if (input_password.Text == reinput_password.Text){

        auth.CreateUserWithEmailAndPassword(email, password)

          .AddOnCompleteListener(this, this);


        auth.sendEmailVerification(email)

           .AddOnCompleteListener(this, this);

    }

}

标签: c#androidfirebasexamarinfirebase-authentication

解决方案


SendEmailVerification(Async)FirebaseUser实例上的方法:

示例(使用 Xamarin 异步包装器):

auth = FirebaseAuth.Instance;
using (var authResult = await auth.CreateUserWithEmailAndPasswordAsync("so@sushi.com", "stackoverflow"))
using (var user = authResult.User)
using (var actionCode = ActionCodeSettings.NewBuilder().SetAndroidPackageName(PackageName,true, "0").Build())
{
    await user.SendEmailVerificationAsync(actionCode);
}

推荐阅读