The Delete Self password method wraps the Delete Member password API endpoint. The organization_id and member_id will be automatically inferred from the logged-in Member's session. This method can only be used to delete the logged-in Member's password.
Delete Self password
import { useStytchB2BClient, useStytchMember } from '@stytch/react/b2b';
export const DeletePassword = () => {
const stytch = useStytchB2BClient();
const { member } = useStytchMember();
const deletePassword = () => {
if (member?.member_password_id) {
stytch.self.deletePassword(member.member_password_id);
}
};
return <button onClick={deletePassword}>Delete Password</button>;
};
RESPONSE 200
200
{
"member": {...},
"member_id": "member-test-32fc5024-9c09-4da3-bd2e-c9ce4da9375f",
"organization": {...}
"request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
"status_code": 200
}
RESPONSE 401
200
{
"status_code": 401,
"request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
"error_type": "unauthorized_credentials",
"error_message": "Unauthorized credentials.",
"error_url": "https://stytch.com/docs/api/errors/401"
}
RESPONSE 403
200
{
"status_code": 403,
"request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
"error_type": "session_authorization_error",
"error_message": "The Member is not authorized to perform the requested action on that resource.",
"error_url": "https://stytch.com/docs/api/errors/403"
}
RESPONSE 429
200
{
"status_code": 429,
"request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
"error_type": "too_many_requests",
"error_message": "Too many requests have been made.",
"error_url": "https://stytch.com/docs/api/errors/429"
}
RESPONSE 500
200
{
"status_code": 500,
"request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
"error_type": "internal_server_error",
"error_message": "Oops, something seems to have gone wrong, please reach out to support@stytch.com to let us know what went wrong.",
"error_url": "https://stytch.com/docs/api/errors/500"
}