I'm trying to write some code in our PHP application that currently uses the AWS SDK for PHP version 2.8.31 to essentially sign in a user that's in a Cognito User Pool so that we can then use that user's identity to call AWS API Lambda methods. The API Gateway will use Cognito as the authorizer.
The problem I'm having is that all the examples I'm finding online for getting this done are using version 3 of the PHP SDK that has the CognitoIdentityProviderClient
class that provides the adminInitiateAuth
method that gets the Access Token that you need to call the API Gateway with.
Is there a way to do this with the v2 of the AWS SDK for PHP (https://docs.aws.amazon.com/aws-sdk-php/v2/guide/)?
The CognitoIdentityClient
seems like it might be the way, but the only relevant methods I see are getId
and then getCredentialsForIdentity
, but these still don't get me the Access Token I need to pass to the API Gateway. I can also see GetOpenIdToken
and GetOpenIdTokenForDeveloperIdentity
but the 'IdentityProviderName'
parameter that they are asking for doesn't seem to support Cognito User Pool as the provider?
I'm just hoping that someone out there knows a enough about these methods to let me know if this is even possible with the V2 of the SDK.