Overview
You are looking for instructions on how to reset the password of a Cognito user part of your Totogi Tenant using the GraphQL API.
Solution
In order to Reset the password of a Cognito user, one should use the resetUserPassword mutation API call. With this method, the user will get a reset password link to the registered email address.
In order to make the requests through the API, the information below is required:
- The Provider ID.
- An Access Token using the credentials from the Tenant Admin User.
Below is an example payload to reset the password of a Cognito user with Tenant admin roles with some important specifications:
- Only the user ID and Provider ID are inputs.
- The request handles different possible results such as what to return if the
UserNotFound or an UserIncorrectStatus scenario.
- In order to reset the password a valid email address is needed. The tenantAdmin can update the email address if this field is incorrectly set for the user.
mutation ResetUserPassword {
resetUserPassword(
input: {
providerId: "<Provider ID>"
userId: "<User ID>"
}
) {
... on ResetUserPasswordPayload {
__typename
userId
}
... on UserIncorrectStatus {
providerId
userId
errorCode
errorMessage
}
... on UserNotFound {
errorCode
errorMessage
userId
}
}
}
The result (if the password reset link was generated) is the status result and the user ID for whom the password reset link was generated.