Beispiel #1
0
        // _perform_auth_request
        private static async Task <Dictionary <string, string> > PerformAuthRequestAsync(Dictionary <string, string> data)
        {
            var content = new FormUrlEncodedContent(data);

            var response = await HttpClient.PostAsync(AuthUrl, content);

            response.EnsureSuccessStatusCode();

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

            return(GoogleKeyUtils.ParseAuthResponse(result));
        }
Beispiel #2
0
        // perform_master_login
        public static async Task <Dictionary <string, string> > PerformMasterLoginAsync(UserDetails userDetails, LocaleDetails localeDetails,
                                                                                        string service = "ac2dm", int sdkVersion = 17)
        {
            var signature = GoogleKeyUtils.CreateSignature(userDetails.Email, userDetails.Password, AndroidKey);

            var dict = new Dictionary <string, string>
            {
                { "accountType", "HOSTED_OR_GOOGLE" },
                { "Email", userDetails.Email },
                { "has_permission", "1" },
                { "add_account", "1" },
                { "EncryptedPasswd", signature },
                { "service", service },
                { "source", "android" },
                { "androidId", userDetails.AndroidId },
                { "device_country", localeDetails.DeviceCountry },
                { "operatorCountry", localeDetails.OperatorCountry },
                { "lang", localeDetails.Language },
                { "sdk_version", sdkVersion.ToString() }
            };

            return(await PerformAuthRequestAsync(dict));
        }