Xamarin与Firebase形成跨平台应用程序身份验证
我想向用户发送电子邮件并向他们发送重置密码请求。 我还没找到解决办法Xamarin与Firebase形成跨平台应用程序身份验证,firebase,authentication,xamarin,xamarin.forms,cross-platform,Firebase,Authentication,Xamarin,Xamarin.forms,Cross Platform,我想向用户发送电子邮件并向他们发送重置密码请求。 我还没找到解决办法 private async void ForgetPassword_Clicked(object sende, EventArgs e) { var authReset = new FirebaseAuthProvider(new FirebaseConfig(WebAPIkey)); try { var
private async void ForgetPassword_Clicked(object sende, EventArgs e)
{
var authReset = new FirebaseAuthProvider(new FirebaseConfig(WebAPIkey));
try
{
var email = UserLoginEmail.Text;
var auth = await authReset.SendPasswordResetEmailAsync(UserLoginEmail.Text);
var content = await auth.GetFreshAuthAsync();
var serializedcontent = JsonConvert.SerializeObject(content);
Preferences.Set("MyFirebaseRefreshToken", serializedcontent);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
await App.Current.MainPage.DisplayAlert("Alert", "Invalid email or password", "OK");
}
}
我想出来了。但是如果有更好的办法,请告诉我
private async void ForgetPassword_Clicked(object sende, EventArgs e)
{
var authReset = new FirebaseAuthProvider(new FirebaseConfig(WebAPIkey));
try
{
var email = UserLoginEmail.Text;
var auth = authReset.SendPasswordResetEmailAsync(UserLoginEmail.Text);
await App.Current.MainPage.DisplayAlert("Alert", "Email Sent", "OK");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
await App.Current.MainPage.DisplayAlert("Alert", "Invalid email or password", "OK");
}
}
我想出来了。但是如果有更好的办法,请告诉我
private async void ForgetPassword_Clicked(object sende, EventArgs e)
{
var authReset = new FirebaseAuthProvider(new FirebaseConfig(WebAPIkey));
try
{
var email = UserLoginEmail.Text;
var auth = authReset.SendPasswordResetEmailAsync(UserLoginEmail.Text);
await App.Current.MainPage.DisplayAlert("Alert", "Email Sent", "OK");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
await App.Current.MainPage.DisplayAlert("Alert", "Invalid email or password", "OK");
}
}
谢谢你的分享,请接受它作为答案。这将帮助其他有类似问题的人。感谢您的分享,请接受它作为答案。它将帮助其他有类似问题的人。