public override void TryAuth(params object[] args)
        {
        #if UNITY_EDITOR || UNITY_STANDALONE
            if (HotkeyCoroutine.IsLocked())
            {
                base.OnError?.Invoke(null);
                return;
            }

            if (TryExtractProvider(args, out SocialProvider provider))
            {
                HotkeyCoroutine.Lock();

                string url = SdkLoginLogic.Instance.GetSocialNetworkAuthUrl(provider);
                Debug.Log($"Social url: {url}");

                var browser = BrowserHelper.Instance.InAppBrowser;
                browser.Open(url);
                browser.AddCloseHandler(BrowserCloseHandler);
                browser.AddUrlChangeHandler(UrlChangedHandler);
            }
            else
            {
                Debug.LogError("SocialAuth.TryAuth: Could not extract argument");
                base.OnError?.Invoke(new Error(errorMessage: "Social auth failed"));
            }
        #endif
        }
        private IEnumerator SuccessAuthCoroutine(string token)
        {
            yield return(new WaitForEndOfFrame());

            if (EnvironmentDefiner.IsStandaloneOrEditor)
            {
                BrowserHelper.Instance.Close();
                HotkeyCoroutine.Unlock();
            }

            base.OnSuccess?.Invoke(token);
        }
        public void LinkSocialProvider(SocialProvider socialProvider, Action <SocialProvider> onSuccess, Action <Error> onError = null)
        {
            if (!EnvironmentDefiner.IsStandaloneOrEditor)
            {
                var errorMessage = "LinkSocialProvider: This functionality is not supported elswere except Editor and Standalone build";
                Debug.LogError(errorMessage);
                onError?.Invoke(new Error(ErrorType.MethodIsNotAllowed, errorMessage: errorMessage));
                return;
            }

            Action <string> urlCallback = url =>
            {
                var browser = BrowserHelper.Instance.InAppBrowser;
                if (browser == null)
                {
                    Debug.LogError("LinkSocialProvider: Can not obtain in-built browser");
                    onError?.Invoke(null);
                    return;
                }

                browser.Open(url);
                browser.AddInitHandler(() =>
                {
                    browser.AddUrlChangeHandler(newUrl =>
                    {
                        Debug.Log($"URL = {newUrl}");

                        if (ParseUtils.TryGetValueFromUrl(newUrl, ParseParameter.token, out _))
                        {
                            browser.Close();
                            HotkeyCoroutine.Unlock();
                            onSuccess?.Invoke(socialProvider);
                            return;
                        }

                        if (ParseUtils.TryGetValueFromUrl(newUrl, ParseParameter.error_code, out string errorCode) &&
                            ParseUtils.TryGetValueFromUrl(newUrl, ParseParameter.error_description, out string errorDescription))
                        {
                            browser.Close();
                            HotkeyCoroutine.Unlock();
                            onError?.Invoke(new Error(statusCode: errorCode, errorMessage: errorDescription));
                        }
                    });
                });
            };

            XsollaLogin.Instance.LinkSocialProvider(socialProvider, urlCallback, onError);
        }
 private void BrowserCloseHandler()
 {
     HotkeyCoroutine.Unlock();
     base.OnError?.Invoke(null);
 }