Ejemplo n.º 1
0
        public static async Task <Client> GetClientFromCookieAsync(string cookie)
        {
            var request = new FlurlRequest();

            request.EnableCookies();

            var loginHint = await GetGoogleLoginHintAsync(request, cookie.Split(new[] { "; " }, StringSplitOptions.RemoveEmptyEntries).Select(c => c.Split('=')).ToDictionary(k => k[0], v => string.Join("=", v.Skip(1))));

            var googleLoginToken = await GetGoogleLoginTokenAsync(request, loginHint.Sessions[0].Login_Hint);

            var eeuTokenResponse = await "https://auth.ee-universe.com/auth/token".PostJsonAsync(new
            {
                method = "google",
                token  = googleLoginToken.Id_Token
            }).ReceiveJson <LoginResponse>();

            return(new ActualClient(eeuTokenResponse.Token));
        }