AWS PHP SDK Cognito User Auth

346 Views Asked by At

How can I verify if a user is logged in on my services with AWS PHP SDK? I am logging them with :

$result = $this->awsCognitoClient->adminInitiateAuth([
    'AuthFlow' => 'ADMIN_NO_SRP_AUTH',
    'ClientId' => $this->appClientID,
    'UserPoolId' => $this->userPoolID,
    'AuthParameters' => [
        'USERNAME' => $userName,
        'PASSWORD' => $password,
    ],
]);

That provides a session token. I want to send that token to another of my services and in that other service I want to check if the token is valid or not. How should I proceed? Is this the best way or is there a better method to authenticate my user?

1

There are 1 best solutions below

0
On

To solve this issue i created a singleton instance of an AWSAutWrapper and i share the accesstoken with other services.