Home > Software engineering >  AWS Cognito Pre authentication get user data
AWS Cognito Pre authentication get user data

Time:12-01

I can't extract the username/password pair from the request.

2022-11-30T03:11:13.958Z    xxxxxxxxxxxxxxxxxxxxx INFO{
  version: '1',
  region: 'xxxxxxxxx',
  userPoolId: 'xxxxxxxxxxxxx',
  userName: 'test',
  callerContext: {
    awsSdkVersion: 'aws-sdk-unknown-unknown',
    clientId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxx'
  },
  triggerSource: 'PreAuthentication_Authentication',
  request: { userAttributes: {}, validationData: null, userNotFound: true },
  response: {}
}

Node script:

export const handler = async(event, context, callback) => {
    console.log(event);
    console.log(event.request);
    console.log(context);
    console.log(context.body);
    const response = {
        statusCode: 200,
        body: JSON.stringify('Hello from Lambda!'),
    };
    return response;
};

Add all rights to Identity and Access Management (IAM), but unfortunately I can't see the password either, it's possible that it can't be extracted.

CodePudding user response:

You (the AWS account user / role) cannot see, view, or extract the Cognito users' passwords ever, this is the purpose of Cognito as a service.

If you really want to do this you could do the signup outside of Cognito with your own system, then set the password manually for the user in Cognito with adminSetPassword.

  • Related