What is the AWS SDK library for signin in Cognito (from backend without using Amplify)?

Viewed 667

I have implemented user signup using @aws-sdk/client-cognito-identity-provider but not able to find the module or API from AWS SDK to implement sign in to cognito

1 Answers

@aws-sdk/client-cognito-identity-provider is the right lib for what you want to do.

import * as AWS from "@aws-sdk/client-cognito-identity-provider";
const client = new AWS.CognitoIdentityProvider({ region: "REGION" });

client.initiateAuth({
    ClientId: '...',
    AuthFlow: 'USER_PASSWORD_AUTH',
    AuthParameters: {
        USERNAME: 'my_test_user',
        PASSWORD: '...'
    }
}, function(err, data) {});
Related