- Newest
- Most votes
- Most comments
It appears that there might be an issue with the trust relationship or the role configuration for your Cognito Identity Pool. Even though you've assigned the AmazonTextractFullAccess policy to the Texttract_API_Users role, there could be additional factors preventing the execution of the AnalyzeExpense action.
Here are a few things to check and consider:
-
Verify that the trust relationship for the Texttract_API_Users role is correctly set up to allow Amazon Cognito to assume the role. The trust policy should include the Cognito Identity service principal and your specific Identity Pool ID.
-
Make sure that the Identity Pool is correctly configured to use the Texttract_API_Users role for authenticated or unauthenticated users, depending on your use case.
-
Check if there are any session policies or scope-down policies applied to the role that might be restricting access to specific Textract actions.
-
Ensure that the AmazonTextractFullAccess policy hasn't been modified or overridden by other more restrictive policies attached to the role.
-
Verify that the region you're using for Textract operations matches the region where your Identity Pool and IAM role are set up.
Regarding your question about STS and CognitoIdentityCredentials:
STS stands for AWS Security Token Service. It's a web service that enables you to request temporary, limited-privilege credentials for AWS Identity and Access Management (IAM) users or for users you authenticate (federated users).
CognitoIdentityCredentials is likely referring to the temporary credentials obtained through Amazon Cognito Identity Pools. When a user authenticates through Cognito (or as an unauthenticated guest), Cognito uses STS to assume the specified IAM role and provide temporary credentials to the user. These credentials are then used to access AWS services like Textract.
The fact that DetectDocumentText works but AnalyzeExpense doesn't suggests that there might be a more granular permission issue or a misconfiguration in how the role or session policies are set up. Double-check all aspects of your IAM and Cognito configuration to ensure proper permissions are granted for the AnalyzeExpense action.
Sources
IAM roles - Amazon Cognito
Fine grained access control with cognito identity and custom claims | AWS re:Post
The OIDC token authenticated by the identity pool fails to obtain the corresponding authorization role credentials | AWS re:Post
