Skip to content
This repository has been archived by the owner on Jan 12, 2023. It is now read-only.

Commit

Permalink
Use the K8S_AUTH_BEARER_TOKEN env var for authorizedFetch (#986)
Browse files Browse the repository at this point in the history
Signed-off-by: yzamir <[email protected]>

Signed-off-by: yzamir <[email protected]>
  • Loading branch information
yaacov authored Aug 30, 2022
1 parent bd22b12 commit d8caa16
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/web/src/app/queries/fetchHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ export const authorizedFetch = async <TResponse, TData = unknown>(
extraHeaders['Authorization'] = `Bearer ${fetchContext.currentUser.access_token}`;
}

if (ENV.AUTH_REQUIRED === 'false' && ENV.K8S_AUTH_BEARER_TOKEN) {
extraHeaders['Authorization'] = `Bearer ${ENV.K8S_AUTH_BEARER_TOKEN}`;
}

try {
const response = await fetch(url, {
headers: extraHeaders,
Expand Down

0 comments on commit d8caa16

Please sign in to comment.