Skip to content

Commit

Permalink
Don't send ":" Auth header when username and pass are both empty (kia…
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitsakala committed Aug 30, 2023
1 parent d6f9027 commit 1dae15c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions frontend/src/services/Api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,18 @@ export const login = async (

const proxyUrl = getAPIProxy();

return axios({
const axiosRequest = {
method: HTTP_VERBS.POST,
url: proxyUrl ? `${proxyUrl}/${urls.authenticate}` : urls.authenticate,
headers: getHeaders(proxyUrl),
auth: basicAuth(request.username, request.password),
data: params
});
};

if (request.username !== '' || request.password !== '') {
axiosRequest['auth'] = basicAuth(request.username, request.password);
}

return axios(axiosRequest);
};

export const logout = () => {
Expand Down

0 comments on commit 1dae15c

Please sign in to comment.