public void SignUp(OnAuthorizationSuccessDelegate OnSuccessDelegate, OnAuthorizationFailedDelegate OnFailedDelegate, bool forceExternalBrowser = false) { string url = QUARTERS_URL + "/guest?token=" + session.GuestToken + "&redirect_uri=" + URL_SCHEME + "&inline=trueresponse_type=code&client_id=" + QuartersInit.Instance.APP_ID; this.OnAuthorizationSuccess = OnSuccessDelegate; this.OnAuthorizationFailed = OnFailedDelegate; if (Application.isEditor && forceExternalBrowser) { //spawn editor UI Instantiate <GameObject>(Resources.Load <GameObject>("QuartersEditor")); Application.OpenURL(url); } else { //direct to the browser if (!forceExternalBrowser) { //web view authentication QuartersWebView.OpenURL(url); QuartersWebView.OnDeepLink = DeepLink; } else { //external authentication Application.OpenURL(url); } } }
public void AuthorizeGuest(OnAuthorizationSuccessDelegate OnSuccessDelegate, OnAuthorizationFailedDelegate OnFailedDelegate) { session = new QuartersSession(); if (!string.IsNullOrEmpty(session.RefreshToken)) { Debug.LogError("Authorization error. Registered user session exist. Use Authorize User call instead, or Deauthorize Quarters user first"); return; } this.OnAuthorizationSuccess = OnSuccessDelegate; this.OnAuthorizationFailed = OnFailedDelegate; if (IsAuthorized) { this.OnAuthorizationSuccess(); return; } if (OnAuthorizationStart != null) { OnAuthorizationStart(); } //create new guest account StartCoroutine(CreateNewGuestUser()); }
public void Deauthorize() { this.session.Invalidate(); this.session = null; CurrentUser = null; //clean up delegates OnAuthorizationStart = null; OnAuthorizationSuccess = null; OnAuthorizationFailed = null; currentTransferAPIRequests = new List <TransferAPIRequest>(); }
public void Authorize(OnAuthorizationSuccessDelegate OnSuccessDelegate, OnAuthorizationFailedDelegate OnFailedDelegate, bool forceExternalBrowser = false) { if (!forceExternalBrowser && Application.platform == RuntimePlatform.WindowsEditor) { Debug.LogWarning("Quarters: WebView is not supported in Unity Editor on Windows. Falling back to forcing external browser. You can safely ignore this message"); forceExternalBrowser = true; } session = new QuartersSession(); this.OnAuthorizationSuccess = OnSuccessDelegate; this.OnAuthorizationFailed = OnFailedDelegate; if (IsAuthorized) { this.OnAuthorizationSuccess(); return; } Debug.Log("Quarters: Authorize new session"); if (OnAuthorizationStart != null) { OnAuthorizationStart(); } if (Application.isEditor && forceExternalBrowser) { //spawn editor UI GameObject.Instantiate <GameObject>(Resources.Load <GameObject>("QuartersEditor")); AuthorizeEditor(); } else { //direct to the browser AuthorizeExternal(); } }
public void Authorize(OnAuthorizationSuccessDelegate OnSuccessDelegate, OnAuthorizationFailedDelegate OnFailedDelegate) { this.OnAuthorizationSuccess = OnSuccessDelegate; this.OnAuthorizationFailed = OnFailedDelegate; Debug.Log("Quarters: Authorize"); if (OnAuthorizationStart != null) { OnAuthorizationStart(); } if (Application.isEditor) { //spawn editor UI GameObject.Instantiate <GameObject>(Resources.Load <GameObject>("QuartersEditor")); AuthorizeEditor(); } else { //direct to the browser AuthorizeExternal(); } }