generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 89
Open
Labels
@authbugSomething isn't workingSomething isn't workingduplicateThis issue or pull request already existsThis issue or pull request already existsgraphql-transformer-v2migration-issuep2
Description
Before opening, please confirm:
- I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
- I have searched for duplicate or closed issues.
- I have read the guide for submitting bug reports.
- I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- I have removed any sensitive information from my code snippets and submission.
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
14
Amplify CLI Version
7.6.20
What operating system are you using?
Windows
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No manual changes made
Amplify Categories
auth, api
Amplify Commands
add
Describe the bug
I upgraded from GraphQL transformer version: 1 to 2, updated my schema, deployed the changes and I see getting awful lot of 'Unauthorized' responses completely breaking my app in many places.
This is my model (one of them):
type Client @model
@auth(rules: [
{ allow: groups, groups: ["Root"] },
{ allow: groups, groups: ["Partner"], operations: [create] },
{ allow: groups, groupsField: "id", groupClaim: "client:owner" },
{ allow: groups, groupsField: "id", groupClaim: "client:custodian", operations: [read, update] },
{ allow: groups, groupsField: "id", groupClaim: "client:user", operations: [read] }
])
{
id: ID! @primaryKey
name: String!
createdAt: AWSDateTime!
updatedAt: AWSDateTime
}
I configure amplify to send ID token to the server
Amplify.configure({
API: {
graphql_headers: async () => {
const session = await Auth.currentSession();
const idToken = session.getIdToken();
return {
Authorization: idToken.getJwtToken()
};
}
},
});
My token has:
client:custodian: "[\"GVP8919\"]"
There is the corresponding entry in the database with that ID.
And yet, the list operation does not return any results 😦
{"data":{"listClients":{"__typename":"ModelClientConnection","items":[],"nextToken":null}}}
I am using Cognito user pools for authentication.
Expected behavior
@auth with groupsField and groupClaim works the way it used to
Reproduction steps
- Update to V2
- Create a model as described below
- Login as user with Cognito Id token with custom claim as shown above
- Attempt a list on the model
GraphQL schema(s)
# Put schemas below this line
Log output
# Put your logs below this line
Additional information
No response
hanna-becker, dlamon1, jcary741 and yutaoyan
Metadata
Metadata
Assignees
Labels
@authbugSomething isn't workingSomething isn't workingduplicateThis issue or pull request already existsThis issue or pull request already existsgraphql-transformer-v2migration-issuep2