Skip to content

Account page: use MIP from your own computer with a Keycloak token - #53

Open
KFilippopolitis wants to merge 2 commits into
masterfrom
feat/remote-api-token
Open

KFilippopolitis wants to merge 2 commits into
masterfrom
feat/remote-api-token

Conversation

@KFilippopolitis

Copy link
Copy Markdown
Contributor

What

The account page gets a "Use MIP from your own computer" section for the mip Python client:

  • It is shown only when GET /services/auth-config answers, i.e. when the federation's backend names a public Keycloak client (KEYCLOAK_CLI_CLIENT_ID). Otherwise the section stays hidden.
  • Create access token signs in as that client in the browser (authorization code with PKCE S256, scope=openid offline_access, redirect back to /account). The page exchanges the one-time code, removes it from the address bar, and shows the resulting long-lived token once. Nothing stores it. Users paste it into mip login --token or set MIP_API_TOKEN. This works for servers and scripts without a browser.
  • A copyable guide for mip login, the device flow, for computers with a browser.
  • The earlier guide that sent users to the JupyterHub token page is gone.

Code: src/app/pages/account-page/ (cli-token.ts for the PKCE sign-in, plus the component), and docs/llm-wiki/08-auth-and-terms-flow.md.

Why

Users and scripts outside the hosted notebook need MIP access for 30+ days without depending on JupyterHub. Keycloak stays the only identity provider, and the mip client renews short-lived access tokens itself.

Related

Tests

  • npx ng test --watch=false: 67 files, 909 tests pass. notebook.component.spec.ts is untouched by this branch and occasionally fails when its iframe navigates to the hub login.
  • npx ng build: succeeds; the two existing warnings (algorithm-panel CSS budget, jszip) are unrelated.
  • End to end on federation-handson with the client mip-cli-handson: token created on the account page, then used through MIP_API_TOKEN to read data models; revoked afterwards.

Config

No new UI variables. The feature appears once the backend sets KEYCLOAK_CLI_CLIENT_ID; the Keycloak client needs redirect URI https://<portal>/account and web origin https://<portal>.

The "Use MIP from your own computer" guide now shows only when
/services/auth-config names the federation's public Keycloak client, and no
longer sends users to the JupyterHub token page. "Create access token" runs an
authorization-code sign-in with PKCE as that client (offline_access, in
cli-token.ts), takes the one-time code out of the address bar, and shows the
token once for `mip login --token` or MIP_API_TOKEN; nothing stores it.

The setup snippet only installs the client and sets MIP_URL; the two ways to
sign in (access token, `mip login`) sit side by side in cards, and the guide
says a sign-in lasts at most 6 months, ends after 30 days without use, and
links to the Keycloak account page where it can be ended everywhere.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant