Search code examples
amazon-cognitoamazon-cognito-triggers

How to change username in AWS Cognito when federating with Open ID(Auth0)?


In Cognito user pool federation I added Open ID connect to connect to Auth0 and use Auth0 as Identity Provider.

When logging in via Auth0, Cognito user pool creates an user inside user pool with username like below,

providername_ad|SomeName-Ldap-Linux-Connector-Dev-2|xxxxx-xxxx-xxxx-xxxx-xxxxxx

I don't want the username to be like this as because my application doesn't support this.

Is there a way to tell Cognito user pool, to use different fields(claim) for username from Open ID?

I tried enabling user migration lambda but it never fires.


Solution

  • For a user authenticated using Open ID connect provider, the username is managed by Cognito service in the format {provider name}_{sub}. It is not editable and cannot be changed.