#✅ - Keep getting: No Cognito Identity pool provided for unauthenticated access

9 messages · Page 1 of 1 (latest)

celest briar
#

New to react and AWS. Have setup a new api project using amplify-cli. I need a public API (unauthenticated). So, I setup amplify with amplify configure + init & added api and auth, set it up for unauthenticated access. This is my schema:

  id: ID!
  deviceID: String!
  location: Location!
  expiration: AWSTimestamp!
}

type Location {
  lon: Float!
  lat: Float!
}```

I did push this successfully, however, whenever I call it from the react client using:

await API.graphql({
query: mutations.createMeditationLocation,
variables: {
input: {
deviceID: deviceID,
location: { lat: 1.5, lon: 1.5 },
expiration: expiration,
},
},
authMode: GRAPHQL_AUTH_MODE.AWS_IAM,
});


Im getting 'WARN  [WARN] 01:32.394 GraphQLAPI - ensure credentials error No Cognito Identity pool provided for unauthenticated access'

When I go to the GrapQL API Console and try to run this query:

query MyQuery {
listMeditationLocations {
items {
deviceID
}
}
}


I get:  Not Authorized to access listMeditationLocations on type Query as error message.

Any pointers on how to solve this problem? Thanks in advance!
celest briar
#

Basically executing 'amplify remove auth' followed by 'amplify add analytics' fixed the auth issue I had.

celest briar
#

The remaining question is: how to get permission for the root user to run queries using the grapql api console?

lapis saddle
celest briar
#

What I currently did to solve it (now I can access it with the console, using apiKey): type MeditationLocation @model @aws_iam @aws_api_key @auth( rules: [{allow: public, provider: iam, operations:[create, read, update, delete]}, {allow: public, operations:[create, read, update, delete]} ])

light depotBOT
#

✅ - Keep getting: No Cognito Identity pool provided for unauthenticated access