I have successfully followed this tutorial How to allow guest users to access web applications? (Amplify, AWS AppSync, Cognito & IAM)
By installing @aws-amplify/[email protected] which uses [email protected] to implement a V1 API in AWS.
Note: The tutorial uses v4.37 the latest is v12.6
This is the schema;
type Book
@model
@auth(
rules: [
# allow admins to create, update and delete books
{ allow: groups, groups: ["admin"] }
# allow all authenticated users to view books
{ allow: private, operations: [ read ]}
# allow all guest users ( not authenticated ) to view books
{ allow: public, operations: [read], provider: iam}
]
) {
id: ID!
title: String!
description: String
price: Float
}
When I update to @aws-amplify/[email protected] , amplify push
uses v2 of the graphQL transformer.
With reference to the @auth rules in the schema, I can successfully log into the Cognito User Pool;
- create and list books as an authenticated user of the admin group
- list books as an authenticated user
I get the following error;
Request failed with status code 401
when I try to list books as an unauthenticated user using IAM
Any help in resolving this will be much appreciated?
C.