-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting error "Not Authorized to access deleteUserData on type Mutation" for cleaning up user data #13796
Comments
Hi @lafeer I think the issue might be using Let me know if that helps! Also, in case the |
Hi @chrisbonifacio. Thank you for getting back to me on this. I've tried using When I remove
|
Hi @lafeer the identity will be |
So even with
No, my schema is exactly like it is in the description above. |
Hi @lafeer it seems like your default auth mode is API_KEY according to the config shared:
You should try setting the auth mode on the request like so: const deletedUser = await client.graphql({
query: deleteUserData,
variables: {},
},
{authMode: 'userPool'}
); This should set the Authorization header to the current authenticated user's Cognito access token rather than the |
Hi 👋 Closing this as we have not heard back from you. If you are still experiencing this issue and in need of assistance, please feel free to comment and provide us with any information previously requested by our team members so we can re-open this issue and be better able to assist you. Thank you! |
Hi, I got the same issue "Not Authorized to access deleteUserData on type Mutation". When I test the function from the lambda console, it works. When I test from my app or from the AppSync query editor, I got the error. My schema:
My function:
Any idea? |
Before opening, please confirm:
JavaScript Framework
React Native
Amplify APIs
Authentication, GraphQL API, DataStore
Amplify Version
v6
Amplify Categories
auth, storage, function, api
Backend
Amplify CLI
Environment information
Describe the bug
Getting error "Not Authorized to access deleteUserData on type Mutation" for cleaning up user data when following user data cleanup instructions as described here: Steps for cleaning user data for owner based auth schema
schema.graphql
deleteUserData lambda function
calling deleteUserData
Expected behavior
Expecting the
deleteUserData
function to be successfully calledReproduction steps
deleteUserData
as shown in Describe the bug section above.Code Snippet
// Put your code below this line.
Log output
aws-exports.js
No response
Manual configuration
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: