Example #1
0
        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
        }