Post with api aws

Asked

Viewed 40 times

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:

AWS SDK for . NET

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:
inserir a descrição da imagem aqui

  • 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/

  • 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?

1 answer

0

  • 1

    It seems that adrianojc wants to authenticate on Amazon Cognito and not on S3 directly, but I understand that Cognito can be an authentication method for S3. I imagine your answer does not address the question asked.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.