Is your feature request related to a problem? Please describe.
I would like to suggest a feature—specifically when registering new Cognito users.
I am using AWS Cognito as my authentication provider. I'm able to successfully create a user within Cognito, but would like the users' sub (uuid) returned so that I can use that within my Laravel application. This way the user_id within my Laravel application matches the Username (or sub) in Cognito. FWIW, I am using laravel as an API.
Describe the solution you'd like
When calling createCognitoUser(), the aws instance is returned instead of true. For example, a sample of the response:
Describe alternatives you've considered
I've tried implementing the register() method, but do not wish to provide a password. I'd like Cognito to generate a temporary password just as it does when calling createCognitoUser().
Additional context
I have updated this file: vendor/ellaisys/aws-cognito/src/AwsCognitoClient.php This is right around line #468.
Here I am returning the user that is created in Cognito. I'm also throwing an exception if the username exists.
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
...
try {
$user = $this->client->adminCreateUser($payload);
//Add user to the group
if (!empty($groupname)) {
$this->adminAddUserToGroup($username, $groupname);
}
} catch (CognitoIdentityProviderException $e) {
throw new BadRequestHttpException($e->getAwsErrorMessage()); // "message": "An account with the given email already exists.",
}
...
Returning the $user above is returning me the AWS Cognito user. From there, I'm able to do something like this:
Is your feature request related to a problem? Please describe. I would like to suggest a feature—specifically when registering new Cognito users.
I am using AWS Cognito as my authentication provider. I'm able to successfully create a user within Cognito, but would like the users' sub (uuid) returned so that I can use that within my Laravel application. This way the
user_id
within my Laravel application matches theUsername
(or sub) in Cognito. FWIW, I am using laravel as an API.Describe the solution you'd like When calling
createCognitoUser()
, the aws instance is returned instead oftrue
. For example, a sample of the response:Describe alternatives you've considered I've tried implementing the
register()
method, but do not wish to provide a password. I'd like Cognito to generate a temporary password just as it does when callingcreateCognitoUser()
.Additional context I have updated this file:
vendor/ellaisys/aws-cognito/src/AwsCognitoClient.php
This is right around line #468. Here I am returning the user that is created in Cognito. I'm also throwing an exception if the username exists.Returning the
$user
above is returning me the AWS Cognito user. From there, I'm able to do something like this: