[Dashboard] Add auth header for dashboard dev server #7714
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR improves the local dashboard development workflow by enabling login via OAuth2 or a Service Account.
Currently, the local development server for the dashboard only supports Basic Auth. If the API server uses OAuth2, logging in can be impossible (due to domain policies preventing redirects to
localhost). While manually copying and pasting the OAuth cookie is possible but inconvenient.This PR adds two new authentication methods for the dev server:
When
SKYPILOT_OAUTH_ENABLED=1is set, runningnpm run devwill now fetch an OAuth token using the same mechanism as the SkyPilot SDK (i.e., thesky api logincommand).Additionally, this provides a method to log in using a Service Account token.
Tested (run the relevant ones):
bash format.sh/smoke-test(CI) orpytest tests/test_smoke.py(local)/smoke-test -k test_name(CI) orpytest tests/test_smoke.py::test_name(local)/quicktest-core(CI) orpytest tests/smoke_tests/test_backward_compat.py(local)