question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ClientMetadata not passing to Cognito Trigger, with `Auth.signIn({... , validationData: {foo: 'bar'}})`

See original GitHub issue

Describe the bug ClientMetadata not passing to Cognito Trigger, when using Amplify Custom Ui components and Auth.signIn() Auth.signIn({... , validationData: {foo: 'bar'}}), even with static preconfigured ClientMetadata, Auth.configure({ authenticationFlowType: 'CUSTOM_AUTH', clientMetadata: {foo: 'bar'} }) or Amplify.configure({ Auth: { authenticationFlowType: 'CUSTOM_AUTH', clientMetadata: {foo: 'bar'} } })

To Reproduce Steps to reproduce the behavior:

browser js code

Auth.configure({ clientMetadata: {foo: 'bar'}  })
await Auth.signIn({ username: 'someuser', validationData: {xyz: 'abc'} })

lambda trigger

exports.handler = (event, ctx, callback) => {
  console.log(event)
}

Expected behavior

Expect to see log of foo , xyz ClientMetadata in lambda cloudwatch logs , this are missing.

Additional context Amplify versions

  • “aws-amplify”: “^3.1.1”,
  • “aws-amplify-react”: “^4.2.2”,

You can turn on the debug mode to provide more info for us by setting window.LOG_LEVEL = ‘DEBUG’; in your app.

browser_debug_log

Screenshot_20200905_014143 (1)

cloudwatch log*

2020-09-04T22:19:05.727Z	****	INFO	{
  version: '1',
  region: 'us-west-2',
  userPoolId: '****',
  userName: '****',
  callerContext: {
    awsSdkVersion: 'aws-sdk-unknown-unknown',
    clientId: '****'
  },
  triggerSource: 'DefineAuthChallenge_Authentication',
  request: {
    userAttributes: {
      sub: '****',
      email_verified: 'true',
      'cognito:user_status': 'CONFIRMED',
      'cognito:email_alias': '****',
      given_name: '****',
      family_name: '****',
      email: '****'
    },
    session: [],
    userNotFound: false
  },
  response: { challengeName: null, issueTokens: null, failAuthentication: null }
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:21
  • Comments:32 (5 by maintainers)

github_iconTop GitHub Comments

15reactions
hmelchander-indprocommented, Nov 30, 2020

@sammartinez, thanks for getting back to us on this issue. Do you have any idea when this may be resolved? We are in the progress of rewriting our authentication backend, but if this is resolved within a reasonable timeframe we will skip that rewrite.

The main thing for us is that the clientMetadata should be made available in all the available Cognito lambda triggers. It is also important that if the clientMetadata has been set during Auth.signIn in the js client, it should be set automatically if the Auth framework does an automatic refresh.

8reactions
elorzafecommented, Jan 29, 2021

Amplify JS library has this problem solved. Latest version is sending ClientMetadata for token refresh.

We are expecting now from Cognito service to fix the problem on the server side.

Please +1 on one of this issues on AWS Forums to keep more feedback for this internally https://forums.aws.amazon.com/thread.jspa?messageID=946444&#946444 https://forums.aws.amazon.com/thread.jspa?messageID=910021&#910021

or feel free to create an issue on AWS Forums as well

Read more comments on GitHub >

github_iconTop Results From Across the Web

AWS Cognito and Amplify: clientMetadata not sent when ...
According to API Reference, The ClientMetadata value is passed as input to the functions for ONLY the following triggers:.
Read more >
Yan Cui on Twitter: "The case for and against Amazon Cognito ...
Describe the bug ClientMetadata not passing to Cognito Trigger, when using Amplify Custom Ui components and Auth.signIn() Auth.signIn({... , validationData: { ...
Read more >
Questions tagged with AWS Amplify
ClientMetadata not present in custom challenge triggers ... implement an custom challenge using Amplify -> Cognito, the issue is that when I call:...
Read more >
Pre authentication Lambda trigger - Amazon Cognito
One or more key-value pairs that contain the validation data in the user's sign-in request. To pass this data to your Lambda function,...
Read more >
Adding Users to DynamoDB using a Cognito Post ... - YouTube
In this video I'll walk you through how to create a back end that implements an Amazon Cognito Post-confirmation Lambda Trigger that ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found