简体   繁体   中英

C# Parse.com + Facebook Signup

I'm having trouble implementing the user signup + login functionality in a UWP app. There isn't much information available on how to get this done in C#.NET. If I follow Parse.com's documentation , I get a "Task canceled exception". After doing some research I found this thread here which seems to resolve the exception. I'm able to get to the login page but I don't know how to redirect the user to MainPage.xaml after a successful login.

Two questions: 1- How do I detect that the login was successful? 2- Upon successful authentication by FB, how do I redirect the user to MainPage.xaml or any other page for that matter?

Here's what I have so far:

public sealed partial class FacebookLogin : Page
{
    Task<ParseUser> task;
    CancellationTokenSource source;

    public FacebookLogin()
    {
        this.InitializeComponent();
        FacebookWebViewLogin.Loaded += Facebook_Login ;
    }



    async void Facebook_Login(object sender, RoutedEventArgs e)
    {
        try
        {
            source = new CancellationTokenSource();
            task = ParseFacebookUtils.LogInAsync(FacebookWebViewLogin, new[] { "user_likes", "email" });
            await task;
            Frame.Navigate(typeof(MainPage));
        }
        catch (Exception ex)
        {
            task = null;
        }
    }
}

If you're looking for a way of authenticating with Facebook, Microsoft have a great sample up on their blog which covers this! If you need more help with how it works, I can gladly lend a hand. - Windows SDK for Facebook

enter image description here Making statements based on opinion; back them up with references or personal experience.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM