Need help on the correct way to authenticate for API requests from a custom web page extension

I’ve written a custom web page extension in React for an in-house tracking tool that uses the SonarQube web API. All the GET requests work fine since they don’t seem to require any authentication, but my one POST request only works when not logged into any user.

The POST request is to bulk change some issues by adding and removing tags. If logged into any account, even one different from the owner of the auth token, it begins returning a 401. Logging out “fixes” the issue.

fetch(url, {
method: “POST”,
headers: new Headers({
“Authorization”: Basic ${AUTH_TOKEN}
})
})

How would I go about resolving this or should I be authenticating using the currently logged in user (if that is possible)? Any help would be greatly appreciated.

Someone else at my office was able to figure it out. Rather than using fetch() or manual way of performing API requests, you need to use getJSON() and postJSON().
postJSON("/api/issues/bulk_change", { // Some JSON }

The documentation is a bit lacking all around, especially in terms of what SonarQube offers and how to use it.