Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Download web_app/src/lib/authHeader.ts from CommunityOne/open-navigator: direct link, hf CLI and curl.
- Browser
- Download file 613 Bytes
-
https://huggingface.co/spaces/CommunityOne/open-navigator/resolve/main/web_app/src/lib/authHeader.ts
- Command line
-
hf download hf://spaces/CommunityOne/open-navigator/web_app/src/lib/authHeader.ts
-
curl -L -o authHeader.ts https://huggingface.co/spaces/CommunityOne/open-navigator/resolve/main/web_app/src/lib/authHeader.ts
613 Bytes
| // Attach the stored bearer token to admin/control-plane fetches. | |
| // | |
| // The batch-jobs and deployments clients use plain fetch() (their endpoints | |
| // aren't in the generated OpenAPI client), so they bypass the Authorization | |
| // logic in lib/api.ts. These endpoints are admin-gated on the backend | |
| // (require_admin), so every call must carry the JWT. Use this helper to build | |
| // the headers. | |
| export function authHeaders( | |
| base: Record<string, string> = {}, | |
| ): Record<string, string> { | |
| const token = localStorage.getItem('auth_token') | |
| return token ? { ...base, Authorization: `Bearer ${token}` } : { ...base } | |
| } | |