/** * The Function when the WebView is navigated (is on) */ private async void WebViewOnNavigated(object sender, WebNavigatedEventArgs e) { /* Get the AccessToken from Facebook Server. Using the function written below * * private string ExtractAccessTokenFromUrl(string url) */ var accessToken = ExtractAccessTokenFromUrl(e.Url); // If successfully have the AccessToken if (accessToken != "") { // Then we send them to the FacebookLogInPage with its ViewModel var vm = BindingContext as FacebookLogInPageViewModel; // Set their Profile using the Function written in its ViewModel with the AccessToken await vm.SetFacebookUserProfileAsync(accessToken); // Set the userUID to the app Content = MainStackLayout; vm.IsBusy = true; // Authenticate user with Firebase Authentication & send the UID to the Firebase Server string FirebaseUserUID = await AuthenticationFirebase.AuthenticateFacebookAsync(accessToken); // Check if User is new ?? bool isNew = await UsersFirestore.IsNewUser(FirebaseUserUID); if (!isNew) { UsersFirestore.myProfile = await UsersFirestore.GetUserByUIDAsync(FirebaseUserUID); vm.IsBusy = false; // Welcome back Page WelcomeView.IsVisible = true; } else { // Init a new user details based on Facebook Profile vm.FirstUserInit(FirebaseUserUID); vm.IsBusy = false; // User question add page RegisterView.IsVisible = true; } } }