Exemple #1
0
        private static async Task <Dictionary <string, string> > PerformAuthRequest(Dictionary <string, string> data)
        {
            using (var client = new HttpClient())
            {
                client.DefaultRequestHeaders.UserAgent.TryParseAdd(UserAgent);
                var postResponse = await client.PostAsync(AuthUrl, new FormUrlEncodedContent(data.ToArray()));

                var result = await postResponse.Content.ReadAsStringAsync();

                return(GoogleKeyUtils.ParseAuthResponse(result));
            }
        }
Exemple #2
0
        public async Task <Dictionary <string, string> > PerformMasterLogin(string service       = "ac2dm",
                                                                            string deviceCountry = "us", string operatorCountry = "us", string lang = "en", int sdkVersion = 21)
        {
            var signature = GoogleKeyUtils.CreateSignature(_email, _password, _androidKey);
            var dict      = new Dictionary <string, string> {
                { "accountType", "HOSTED_OR_GOOGLE" },
                { "Email", _email },
                { "has_permission", 1.ToString() },
                { "add_account", 1.ToString() },
                { "EncryptedPasswd", signature },
                { "service", service },
                { "source", "android" },
                { "device_country", deviceCountry },
                { "operatorCountry", operatorCountry },
                { "lang", lang },
                { "sdk_version", sdkVersion.ToString() }
            };

            return(await PerformAuthRequest(dict));
        }