Can anyone see why this code locks a user opposed to actually deleting the user? Version 1.20.0
-
Can anyone see why this code locks a user opposed to actually deleting the user? Version 1.20.0
public static async hardDeleteTestUser(userId: string): Promise<Response> { const jsonBody = { userId, hardDelete: true, }; const resp = await fetch(`${process.env.FUSIONAUTH_ADDRESS}/api/user/${userId}`, { method: 'DELETE', headers: { 'Content-Type': 'application/json', Authorization: process.env.FUSIONAUTH_MASTER_KEY || '', }, body: JSON.stringify(jsonBody), }); DEBUG && Logger.debug( 'FusionAuthService.hardDeleteTestUser', `Return value from fusionAuth status=${resp.status} resp=${JSON.stringify( resp, null, 2 )}`, DEBUG ); return resp; }
-
Two issues with the code snippet that are worth exploring:
-
hardDelete
is supposed to be a query param -
Delete requests should not have
body
in the request.
Find out more in the documentation for the User API
-