Hi,
I am trying to remove a user in jira cloud using rest api https://developer.atlassian.com/cloud/jira/platform/rest/#api-api-2-user-delete from an app.
From rest client like postman it works just fine but from java test case it is not working,
Here is the test case:
@Test
public void deleteCustomer()
{
FakeApplication fakeApplication = Helpers.fakeApplication(inMemoryDatabase("test"));
Helpers.start(fakeApplication);
AcHost acHost = AC.getAcHost("hostKeyFromInstalledAppDb");
WSResponse deleteUserResponse = AC.urlAsUser("/rest/api/2/user", acHost, Option.option("admin")).setQueryParameter("username", "customer@test").delete().get(MAX_TIMEOUT);
assertThat("Could not delete existing test user", deleteUserResponse.getStatus(), is(204));
}
The user I am trying to delete is actually a customer in JSD. (I dont think it matters, because using rest client it works)
When I execute this test, I always get 401(Unauthorized), from postman (using basic authentication with admin user credentials) it succeeds, I get 204.
I am using achost key from the db of an installed app to simulate the app. The app has scope ACT_AS_USER and I would like to delete it with admin user.
A found that documentation says, Apps cannot access this REST resource.
Am I getting 401 because I am calling it from an app even if acting on behalf of admin user?
Or should I authenticate admin user somehow? If so then how?
Thanks,
László