微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Xamarin使用Firebase进行跨平台应用程序身份验证

如何解决Xamarin使用Firebase进行跨平台应用程序身份验证

我想接收用户电子邮件并向他们发送重置密码请求。 我没有解决方案的运气。

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");
        }
    }

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。