private async void BtnSignIn_Click(object sender, EventArgs e) { ((Button)sender).Enabled = false; signInSpinner.Visibility = ViewStates.Visible; var result = await AuthenticateDialog.ShowAsync(this, MsaAuthPurpose.App); if (result == MsaAuthResult.Success) { layouts.Add(Resource.Layout.Intro6); UpdateViewPagerLayout(); GoToNextPage(); } else { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetTitle(result.ToString() + "\n" + "Please try again later."); alert.SetPositiveButton("OK", (senderAlert, args) => { }); RunOnUiThread(() => { alert.Show(); }); MSAAuthenticator.DeleteUserUniqueId(); ((Button)sender).Enabled = true; } signInSpinner.Visibility = ViewStates.Gone; }
public void Display() { GUILayout.BeginVertical(); GUILayout.Label("Login As"); GUILayout.BeginHorizontal(); if (Util.Button("Anonymous")) { AuthenticateDialog.AuthenticateAsAnonymous(); } if (Util.Button("Universal #1")) { AuthenticateDialog.AuthenticateAsUniversal_1(); } if (Util.Button("Universal #2")) { AuthenticateDialog.AuthenticateAsUniversal_2(); } if (Util.Button("Email")) { AuthenticateDialog.AuthenticateAsEmail(); } if (Util.Button("GooglePlay (Android Only)")) { AuthenticateDialog.AuthenticateAsGooglePlay(); } GUILayout.EndHorizontal(); GUILayout.EndVertical(); }
public static void AuthenticateAsEmail(bool forceCreate = false) { GameObject dialogObject = new GameObject("Dialog"); AuthenticateDialog dialog = dialogObject.AddComponent <AuthenticateDialog>(); dialog.m_exampleAccountType = ExampleAccountType.Email; App.Bc.Client.AuthenticationService .AuthenticateEmailPassword(UtilValues.getEmail(), UtilValues.getPassword(), forceCreate, dialog.OnSuccess_Authenticate, dialog.OnError_Authenticate); }
public static void AuthenticateAsAnonymous() { GameObject dialogObject = new GameObject("Dialog"); AuthenticateDialog dialog = dialogObject.AddComponent <AuthenticateDialog>(); dialog.m_exampleAccountType = ExampleAccountType.Anonymous; App.Bc.Client .AuthenticationService.AuthenticateAnonymous(false, dialog.OnSuccess_Authenticate, dialog.OnError_AuthenticateAnonymous); }
public static void AuthenticateAsGooglePlay(bool forceCreate = false) { #if UNITY_ANDROID GameObject dialogObject = new GameObject("Dialog"); AuthenticateDialog dialog = dialogObject.AddComponent <AuthenticateDialog>(); dialog.m_exampleAccountType = ExampleAccountType.GooglePlay; GoogleIdentity.RefreshGoogleIdentity(identity => { App.Bc.AuthenticateGoogle(identity.GoogleId, identity.GoogleToken, forceCreate, dialog.OnSuccess_Authenticate, dialog.OnError_Authenticate); }); #else ErrorDialog.DisplayErrorDialog("AuthenticateAsGooglePlay", "You can only use GooglePlay auth on Android Devices"); #endif }
private void Platform_FetchAuthCode(string oauthUrl) { /*if (!oauthUrl.ToLower().Contains("user.read")) * oauthUrl = oauthUrl.Replace("&scope=", "&scope=User.Read+"); * if (!oauthUrl.ToLower().Contains("device.read")) * oauthUrl = oauthUrl.Replace("&scope=", "&scope=Device.Read+");*/ RunOnUiThread(async() => { System.Diagnostics.Debug.WriteLine(oauthUrl); var result = await AuthenticateDialog.ShowAsync(this, MsaAuthPurpose.ProjectRomePlatform, oauthUrl); if (result != MsaAuthResult.Success) { Toast.MakeText(this, "The app can't work without your permission.", ToastLength.Long); } }); }