I'm trying to make a Post
for a AWS service. Home
I have never worked with AWS and I am studying some links and I am initially doing a connection test using this code:
private static async void SignInUserAsync()
{
var provider = new AmazonCognitoIdentityProviderClient(new AnonymousAWSCredentials(), RegionEndpoint.GetBySystemName("us-east-1"));
try
{
string Access_Key = "ZZZZZZZZZZZZOOOOOOO";
string Secret_Key = "XXXXXXXXXXYYYYYYYYYYYYY";
var authReq = new AdminInitiateAuthRequest
{
AuthFlow = AuthFlowType.ADMIN_NO_SRP_AUTH,
UserPoolId = Access_Key,
ClientId = Secret_Key
};
AdminInitiateAuthResponse authResp = await provider.AdminInitiateAuthAsync(authReq);
if (authResp != null)
{
Console.WriteLine("Autenticação ok!");
}
else
{
Console.WriteLine("falhou!");
}
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
I installed the SDK:
The following extensions in VS2017:
AWS Toolkit for Visual Studio 2017
The question is that I can not authenticate with AWS because it returns error 400, the key and the access code sent by the client: