I am trying to generate long lived access tokens to our app for our users in a cognito user pool (similar to the functionality of github/gitlab access tokens). So far i have not found a best practice on how to achieve this. I don't want to just generate a seperate IAM user for each cognito user and then hand out the AWS_ACCESS_KEY for multiple reasons.
The naive solution i thought of so far is to track custom tokens (just a string) in dynamodb and then exposing a public api endpoint "authenticateToken" that basically checks if the token matches one in the database and returns short AWS session credentials through STS then.
Is this a valid approach? or is there an AWS feature i didn't think of