尝试从“ https://android.clients.google.com”获取令牌时出现“禁止403错误”

时间:2019-11-04 10:09:32

标签: c# google-api-client

当我尝试使用正确的用户名和密码服务器从'https://android.clients.google.com'获取令牌时,返回403错误。

我正在使用下面的代码链接: https://github.com/kagasu/GooglePlayStoreApi/blob/master/GooglePlayStoreApi/GooglePlayStoreClient.cs

  public async Task<string> GetGoogleToken()
        {
            var content = new FormUrlEncodedContent(new Dictionary<string, string>
            {
                { "androidId", AndroidId },
                { "lang", Country.GetCountryCode() },
                { "google_play_services_version", GOOGLE_PLAY_SERVICE_VERSION },
                { "sdk_version", "19" },
                { "device_country", Country.GetCountry() },
                { "callerSig", "38918a453d07199354f8b19af05ec6562ced5788" },
                { "Email", GoogleEmailAddress },
                { "get_accountid", "1" },
                { "add_account", "1" },
                { "service", "ac2dm" },
                { "callerPkg", "com.android.settings" },
                { "EncryptedPasswd", PasswordCryptor.EncryptPassword(GoogleEmailAddress, GooglePassword) },
            });

            var response = await client.PostAsync($"{API_ENDPOINT}/auth", content);
            var str = await response.Content.ReadAsStringAsync();
            var parameters = str.Split('\n').ToDictionary(x => x.Split('=')[0], x => x.Split('=')[1]);
            Token = parameters["Token"];
            return Token;
        }

0 个答案:

没有答案