merlyn/frontend/src/utils/request.js
Timothy Carambat 62e3f62e82
12 auth implementation (#13)
* Add Auth protection for cloud-based or private instances

* skip check on local dev
2023-06-09 11:27:27 -07:00

10 lines
381 B
JavaScript

// Sets up the base headers for all authenticated requests so that we are able to prevent
// basic spoofing since a valid token is required and that cannot be spoofed
export function baseHeaders(providedToken = null) {
const token =
providedToken || window.localStorage.getItem("anythingllm_authtoken");
return {
Authorization: token ? `Bearer ${token}` : null,
};
}