Amplify GraphQL V1 to V2 migration Authorization Issues

Amplify GraphQL V1 to V2 migration Authorization Issues


0

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;

  1. create and list books as an authenticated user of the admin group
  2. 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.


Load 7 more related questions


Show fewer related questions

0



Leave a Reply

Your email address will not be published. Required fields are marked *