Hi There,
I have been following https://serverless-stack.com/chapters/create-a-cognito-user-pool.html this tutorial to create a react app that connects to an authenticated API. All of it is working fine with the exception of authenticating via the API. I’ve setup the Cognito User pool, Identity Pool and client ID. I’m able to login via the app but I keep getting the error below:
CognitoIdentityCredentials is not authorized to access this resource
My config for the API is:
Policies:
- PolicyName: 'CognitoAuthorizedPolicy'
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: 'Allow'
Action:
- 'mobileanalytics:PutEvents'
- 'cognito-sync:*'
- 'cognito-identity:*'
Resource: '*'
# Allow users to invoke our API
- Effect: 'Allow'
Action:
- 'execute-api:Invoke'
Resource:
Fn::Join:
- ''
-
- 'arn:aws:execute-api:'
- Ref: AWS::Region
- ':'
- Ref: AWS::AccountId
- ':'
- Ref: ApiGatewayRestApi
- '/*'
I’m not sure what else I need to add to my serverless.yml. Any help is appreciated.
Sean