我正在尝试启动Aws :: CognitoIdentityProvider :: CognitoIdentityProviderClient InitiateAuth
这是我的代码:
Aws::Client::ClientConfiguration clientConfiguration;
clientConfiguration.region = regionId;
clientConfiguration.proxyHost = "<>";
clientConfiguration.proxyPort = <>;
clientConfiguration.proxyScheme = Aws::Http::Scheme::HTTP;
Aws::CognitoIdentityProvider::Model::InitiateAuthRequest authRequest;
authRequest.SetAuthFlow(Aws::CognitoIdentityProvider::Model::AuthFlowType::USER_SRP_AUTH);
authRequest.SetClientId(clientId);
authParameters.insert(std::make_pair("USERNAME", userName));
authParameters.insert(std::make_pair("SRP_A", srp_A));
authRequest.SetAuthParameters(authParameters);
std::shared_ptr<Aws::CognitoIdentityProvider::CognitoIdentityProviderClient> cognitoClient = std::make_shared<Aws::CognitoIdentityProvider::CognitoIdentityProviderClient>(clientConfiguration);
auto authRequestResult = cognitoClient->InitiateAuth(authRequest);
这是我在跟踪日志中得到的:
[TRACE] 2018-10-24 14:02:16 CurlHttpClient [140737353963648]内容长度:935 [TRACE] 2018-10-24 14:02:16 CurlHttpClient [140737353963648]内容类型:application / x-amz-json-1.1 [TRACE] 2018-10-24 14:02:16 CurlHttpClient [140737353963648]主持人:cognito-idp.eu-west-1.amazonaws.com [TRACE] 2018-10-24 14:02:16 CurlHttpClient [140737353963648]用户代理:aws-sdk-cpp / 1.6.30 Linux / 3.10.0-862.9.1.el7.x86_64 x86_64 GCC / 4.8.5 [TRACE] 2018-10-24 14:02:16 CurlHttpClient [140737353963648] x-amz-target:AWSCognitoIdentityProviderService.InitiateAuth [DEBUG] 2018-10-24 14:02:26 CURL [140737353963648](HeaderIn)HTTP / 1.1 400错误请求
我已经进行了调试,并且我认为在后台代码执行的等效项是: 卷曲-i \ -H“传输编码:” -H“内容长度:914” -H“内容类型:application / x-amz-json-1.1” \ -H“主持人:cognito-idp.eu-west-1.amazonaws.com” -H“用户代理:aws-sdk-cpp / 1.6.30 Linux / 3.10.0-862.9.1.el7.x86_64 x86_64 GCC / 4.8.5” \ -H“ x-amz-target:AWSCognitoIdentityProviderService.InitiateAuth” \ -X POST \ -d'{“ AuthFlow”:“ USER_SRP_AUTH”,“ AuthParameters”:{“ SRP_A”:“ <>”,“ USERNAME”:“ <>”},“ ClientId”:“ <>”}'\ https://cognito-idp.eu-west-1.amazonaws.com --verbose --proxy http://proxy:port
我不知道为什么它不起作用?代理或代码中的设置错误?
请帮助。