You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to assume my identity pool user auth role when invoking my AWS REST API requests. I followed the same code setup for declaring my authentication pools/identity pools. The only change is I modified the Cognito Authenticated role to include permissions to access DynamoDB resources.
In my cloudwatch response, I see the following error:
error: "User: arn:aws:sts::xxxx:assumed-role/example-us-east-1-lambdaRole/example-rest-api-dev-getProducts is not authorized to perform: dynamodb:Query on resource: arn:aws:dynamodb:us-east-1:xxxx:table/products-table"
My assumption is that it should be using the assumed role from the userArn specified above in the identity payload to make the request. However, it appears it is still using the lambda execution role instead still.
Am I missing a step here? Do I need to manually set it to assume the role in the requestContext.identity.userArn? I have tried just about everything to get this to work properly, but keep running into issues. Any help is appreciated!
The text was updated successfully, but these errors were encountered:
Did you find a solution to this? I've ran into a similair issue.
EDIT: Disregard. If I recall correctly, I had set the wrong region in my serverless.yml in relation to the region my DyanmoDB was on. Although it may not be helpful to this situation, it could be to someone who arrives here with a similair error message.
@fostahgix I might not be totally getting your setup but the flow here is that users are given permissions to access your API Gateway/Lambda functions. Once it hits that spot, the permissions are the ones that are given to that Lambda function. It's not based on the user anymore.
Hello,
I am trying to assume my identity pool user auth role when invoking my AWS REST API requests. I followed the same code setup for declaring my authentication pools/identity pools. The only change is I modified the Cognito Authenticated role to include permissions to access DynamoDB resources.
My cognito authenticated identity role:
Using the serverless-stack-demo-client, I log in and I see it obtained the identity id and credentials.
My request.context.identity:
Using the API from aws-amplify, I make a request, much like the notes list example. It sets the auth header as:
In my cloudwatch response, I see the following error:
My assumption is that it should be using the assumed role from the userArn specified above in the identity payload to make the request. However, it appears it is still using the lambda execution role instead still.
Am I missing a step here? Do I need to manually set it to assume the role in the requestContext.identity.userArn? I have tried just about everything to get this to work properly, but keep running into issues. Any help is appreciated!
The text was updated successfully, but these errors were encountered: