Auth0 Home Blog Docs

AWS Lambda and API Gateway: How to get a user's Twitter access token key/access token secret from its sub ID?



When adding authentication to an AWS Lambda function using a Custom Authorizer, the authorizer will create an IAM policy with a principal ID that according to this example, the principal ID should be set to the Auth0 sub field.

If I am not wrong, the only information about the authenticated user that is passed through to the target Lambda function is this principal ID.

My question is: inside the Lambda function, how can I obtain the Twitter access token/access token secret values for the authenticated user – if the user has authenticated and/or linked his Twitter account – so that my Lambda function can post tweets on behalf of the user?

Thanks in advance.


Looks like the context ( is also passed to the Lambda function.
But the question still remains: How to retrieve the authenticated user’s Twitter access token/access token secret (and maybe even the Twitter app’s consumer key/secret) from the Lambda function?