• Home
  • Categories
  • Recent
  • Popular
  • Pricing
  • Contact us
  • Docs
  • Login
FusionAuth
  • Home
  • Categories
  • Recent
  • Popular
  • Pricing
  • Contact us
  • Docs
  • Login

Can anyone see why this code locks a user opposed to actually deleting the user? Version 1.20.0

Scheduled Pinned Locked Moved
Q&A
0
2
239
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J
    joshua
    last edited by 31 Mar 2021, 21:37

    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;
      }
    
    1 Reply Last reply Reply Quote 0
    • J
      joshua
      last edited by joshua 31 Mar 2021, 21:39

      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

      1 Reply Last reply Reply Quote 0
      1 out of 2
      • First post
        1/2
        Last post