protected void OnCheckAuthExistsResponse(ExpandoObject data)
        {
            string error_code = data?.SafeGetString("errorCode");

            if (!string.IsNullOrEmpty(error_code))
            {
                AccountExists = (error_code == ERROR_OK);
            }

            bool is_me = data.SafeGetValue("isSame", false);

            if (AccountExists == true && is_me)
            {
                IsBindDone = true;
            }

            if (mCheckAuthExistsCallback != null)
            {
                mCheckAuthExistsCallback.Invoke(this, AccountExists == true, is_me, data.SafeGetString("name"));
                mCheckAuthExistsCallback = null;
            }

            if (AccountExists.HasValue)
            {
                if (AccountExists == false)
                {
                    RequestBind();
                }
                else if (!is_me)
                {
                    Debug.Log($"[BindProvider] ({ProviderId}) OnCheckAuthExistsResponse - another account found - InvokeAccountBindingCollisionEvent");
                    SnipeAuthCommunicator.InvokeAccountBindingCollisionEvent(this, data.SafeGetString("name"));
                }
            }
        }
 private static void InitInstance()
 {
     if (mInstance == null)
     {
         mInstance = new GameObject("SnipeAuthCommunicator").AddComponent <SnipeAuthCommunicator>();
         GameObject.DontDestroyOnLoad(mInstance.gameObject);
     }
 }
 /// <summary>
 /// Clear all auth data an authorize using specified <c>AuthProvider</c>.
 /// </summary>
 public static void ClearAuthDataAndSetCurrentProvider(AuthProvider provider)
 {
     PlayerPrefs.DeleteKey(SnipePrefs.LOGIN_USER_ID);
     SnipeAuthCommunicator.ClearLoginToken();
     SnipeAuthCommunicator.SetCurrentProvider(provider);
 }
        private void Authorize()
        {
            Debug.Log("[SnipeCommunicator] Authorize");

            SnipeAuthCommunicator.Authorize(OnAuthSucceeded, OnAuthFailed);
        }