Ejemplo n.º 1
0
        private async Task <string> GetTokenFromWebView()
        {
            // Discord doesn't allow access to localStorage so create an iframe to bypass this.
            string token = await CaptchaView.InvokeScriptAsync(
                "eval",
                new[]
            {
                @"
                    iframe = document.createElement('iframe');
                    document.body.appendChild(iframe);
                    iframe.contentWindow.localStorage.getItem('token');
                    //'<<token>>'",
            });

            AnalyticsService.Log(Constants.Analytics.Events.TokenIntercepted);

            return(string.IsNullOrEmpty(token) ? string.Empty : token.Trim('"'));
        }
Ejemplo n.º 2
0
        private async Task<string> GetTokenFromWebView()
        {
            // Discord doesn't allow access to localStorage so create an iframe to bypass this.
            string token = await CaptchaView.InvokeScriptAsync(
                "eval",
                new[]
                {
                    @"
                    iframe = document.createElement('iframe');
                    document.body.appendChild(iframe);
                    iframe.contentWindow.localStorage.getItem('token');
                    //'<<token>>'",
                });

            // Delete token for future
            await CaptchaView.InvokeScriptAsync(
                "eval",
                new[]
                {
                    @"iframe.contentWindow.localStorage.removeItem('token')"
                });

            return string.IsNullOrEmpty(token) ? string.Empty : token.Trim('"');
        }