question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not Authorized to access createProject on type Project with Appsync and Cognito

See original GitHub issue

Describe the bug I’m receiving this error message when trying to execute a mutation, I think isn’t a bug, maybe I just forget to do some configuration, because I’m receiving this error executing the mutation on the Appsync dashboard, and also on the application.

To Reproduce Steps to reproduce the behavior:

  1. Create a project with amplify init
  2. Create an auth amplify add auth

Using service: Cognito, provided by: awscloudformation Do you want to use the default authentication and security configuration? Default configuration How do you want users to be able to sign in? Email Do you want to configure advanced settings? No, I am done.

  1. Create an API amplify add api

Please select from one of the below mentioned services: GraphQL Provide API name: (test) Choose the default authorization type for the API Amazon Cognito User Pool Do you want to configure advanced settings for the GraphQL API No, I am done. Do you have an annotated GraphQL schema? No Choose a schema template: Single object with fields (e.g., “Todo” with ID, name, description)

  1. My Appsync schema
type Project
  @model
  @auth(
    rules: [
      { allow: owner, ownerField: "owner" }
      { allow: owner, ownerField: "members", operations: [read] }
    ]
  ) {
  id: ID!
  name: String!
  owner: String!
  members: [String]
}

Screenshots If applicable, add screenshots to help explain your problem.

image I’m receiving this same error on the application, my user is confirmed by email verification code.

Environment
 System:
    OS: Windows 10 10.0.18363
    CPU: (8) x64 Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz
    Memory: 4.63 GB / 15.82 GB
  Binaries:
    Node: 12.18.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.14.4 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 86.0.4240.193
    Edge: Spartan (44.18362.449.0)
    Internet Explorer: 11.0.18362.1
  npmPackages:
    @types/node: ^12.12.38 => 12.19.4
    eslint-plugin-import: ^2.18.2 => 2.22.1
    eslint-plugin-prettier: ^3.1.1 => 3.1.4
    eslint-plugin-react: ^7.17.0 => 7.21.5
    prettier: ^2.0.4 => 2.1.2
    react-scripts: ^3.4.1 => 3.4.4
  npmGlobalPackages:
    @aws-amplify/cli: 4.32.1
    serverless: 2.6.0

You can turn on the debug mode to provide more info for us by setting window.LOG_LEVEL = ‘DEBUG’; in your app.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
amhinsoncommented, Nov 18, 2020

Ah ok great! Yes, that is definitely a valid use of identityClaim here given your Auth configuration. I’ll close this for now, but feel free to open it back up if you’re still having problems 🙂

0reactions
github-actions[bot]commented, Nov 19, 2021

This issue has been automatically locked since there hasn’t been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Clarity Request: Unexpected "Not Authorized" with IAM and ...
I'm in the process of migrating our existing Amplify GraphQL API (AppSync) over to use the GraphQL Transformer v2 however I'm running into...
Read more >
React app with Cognito User pool: Not authorized to access API
I started with a new React project with AWS Amplify (using the Authenicator from the aws-amplify-react library), added an API and Auth with...
Read more >
Amplify GraphQL Error not authorized to access create
You can open the provisioned auth resource via amplify console auth and select Cognito User Pool. You can create a user via the...
Read more >
Secure AWS AppSync with Amazon Cognito using the AWS ...
Setting up Amazon Cognito for authentication. This project makes use of the L2 constructs for creating an identity pool. This package is not...
Read more >
Amazon Cognito | Noise | Page 2
A common use case for OAuth 2.0 access tokens is to facilitate user authorization to a public facing application. Access tokens can also...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found