Overview
After migrating to Aurora, you will need to adapt your integrations to use API 2.1, instead of 2.0, as API 2.0 is Not Supported on Aurora.
For example you may be getting "401 errors" occurs when attempting to delete users via API, as your integration was originally set up with API 2.0.
This issue arises because API 2.0 is not supported in Aurora, and user deletion is supported via GraphQL in API 2.1 using the CloseUserAccount
mutation.
Resolution Steps:
-
Verify API Version:
- Ensure you are using API 2.1 for user deletion operations.
- Update any /api/2.0/ endpoints to /api/2.1/ or GraphQL.
-
Use GraphQL Mutation for User Deletion:
- Implement the CloseUserAccount mutation for user deletion.
- Ensure the API user has the necessary permissions and authentication.
-
GraphQL Mutation Example (JSON format):
{ "query": "mutation CloseUserAccount($id: ID!, $password: String) { closeUserAccount(id: $id, password: $password) { result errors { ... on Error { __typename message } } } }", "variables": { "id": "user:<USER_ID_TO_BE_REMOVED>", "password": "<PASSWORD_OF_THE_ACCOUNT_AUTHENTICATED_VIA_OAUTH>" }, "operationName": "CloseUserAccount" }
- Replace
<USER_ID_TO_BE_REMOVED>
with the numerical user ID. - Replace
<PASSWORD_OF_THE_ACCOUNT_AUTHENTICATED_VIA_OAUTH>
with the actual password for the user authenticated via oAuth.
- Replace
-
GraphQL Mutation Example (GraphQL format):
mutation CloseUserAccount($id: ID!, $password: String) { closeUserAccount(id: $id, password: $password) { result errors { ... on Error { __typename message } } } }
- Replace
<USER_ID_TO_BE_REMOVED>
with the numerical user ID. - Replace
<PASSWORD_OF_THE_ACCOUNT_AUTHENTICATED_VIA_OAUTH>
with the actual password for the user authenticated via oAuth.
- Replace
-
Verify Resolution:
- Execute the mutation in Postman or a similar tool.
- Confirm the result is true; if not, check for errors in the response.
Important: Ensure your authentication method is compatible with API 2.1 and that the API user has the correct permissions for user deletion in Aurora.
Frequently Asked Questions
- How do I know if this error applies to my situation?
- You'll encounter "401 errors" when attempting to delete users using the integration set up with API 2.0, which is not supported in Aurora.
- What if I need to maintain compatibility with API 2.0?
- API 2.0 is not supported in Aurora. You should update your integrations to use API 2.1 or GraphQL for stable and accurate results.
- How can I verify that the user deletion was successful?
- Execute the CloseUserAccount mutation and check the result. A successful operation will return true; otherwise, check for errors in the response.
- What should I do if I continue to see 401 errors after updating?
- Ensure you are using the correct endpoint version (/api/2.1/), the API user has the necessary permissions, and your authentication method is compatible with API 2.1.
Priyanka Bhotika
Comments