如何通过Cognito用户池授权令牌识别用户?

Thank you for reading this issue, the scenario is below.

User send a request by jwt.Token belong to Cogntio User Pool to API Gateway which is authorized but cannot recognize the request belonge to which user. The "events.APIGatewayProxyResponse" doesn't provide information by default like there openId, email, etc.

How could I recognize user by Authorize token?

The following snippet will get you the user info,

exports.Execute = function(event, callback) {                                                                              
    var params = {                                                                                                           
      AccessToken: 'STRING_VALUE'                                                                                            
    };                                                                                            

    event.cognitoidentityserviceprovider.getUser(params, function(err, data) {                                             
        if (err) {                                                                                                         
            callback(null, err);                                                                                           
        } else {                                                                                                           
            callback(null, data);                                                                                          
        }                                                                                                                  
    });                                                                                                                    

};   

Official documentation from aws can be accessed via the following link.

https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CognitoIdentityServiceProvider.html#getUser-property

Hope it helps.