'GraphQL with Amplify gives 401 Unauthorised for React App (Before and After Adding Auth with Cognito)

I am trying with Amplify and trying to create my first react application, to just fetch simple Ride model.

I am always getting 401 unauthorised error on localhost and after hosting to S3.

errorType: "UnauthorizedException"
message: "You are not authorized to make this call."


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source