1
I’m trying to make a Post
for a service of AWS.
I have never worked with AWS and I am studying some links and uninterruptedly I am 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 on VS2017:
AWS Toolkit for Visual Studio 2017
The doubt is that I cannot authenticate with AWS because it returns error 400, the key and the access code was sent by the client:
some points caught my attention: Are you trying to make an Administrator authentication using anonymous credentials? Have you tried creating keys and utlizar? other material for your reference: https://aws.amazon.com/pt/blogs/mobile/use-csharp-to-register-and-authenticate-with-amazon-cognito-user-pools/
– Rafael Gorski
Adrianojc could you clarify if it is only the Amazoncognito that would like to interact? So when he comments that he wants "Do a post on a service" would be a request in Amazoncognito?
– Rafael Gorski