Пример #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));
        }
Пример #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));
        }