exchange-graph: app-only sign-in with --app-only #44

Merged
jcoffey-dev merged 1 commits from feat/graph-app-only into main 2026-10-30 21:32:21 +00:00
Owner

Roadmap item 13, first part. Graph already had device-code sign-in, but moving a tenant through it still meant one sign-in per person. With --app-only the Entra app signs in as itself, using its client secret, and reads the mailbox --user names. In a plan that is --app-only --user {email}, with the secret named as clientSecret. Exchange Online goes Graph-only in April 2027, so this is the path for Microsoft 365.

  • A new GraphAuth::ClientCredentials / OAuthFlow::ClientCredentials, scope https://graph.microsoft.com/.default.
  • No refresh token comes with it, so the refresher signs in again before the token runs out. The refresh and app-only token requests share one retrying helper.
  • --app-only requires --user, conflicts with --access-token, and refuses common/organizations/consumers as the tenant. The secret comes from $INBUXA_MIGRATE_CLIENT_SECRET or a prompt.
  • A plan's clientSecret now also sets INBUXA_MIGRATE_CLIENT_SECRET.

Tests: a mockito run checks the token request (grant, client, secret, scope), that every Graph call carries the app token under /users/{id}, and that a run without --user is refused; CLI and plan unit tests. Not tried against a real tenant: I have no Entra app to test with. Docs list the application permissions to grant.

Roadmap item 13, first part. Graph already had device-code sign-in, but moving a tenant through it still meant one sign-in per person. With `--app-only` the Entra app signs in as itself, using its client secret, and reads the mailbox `--user` names. In a plan that is `--app-only --user {email}`, with the secret named as `clientSecret`. Exchange Online goes Graph-only in April 2027, so this is the path for Microsoft 365. - A new `GraphAuth::ClientCredentials` / `OAuthFlow::ClientCredentials`, scope `https://graph.microsoft.com/.default`. - No refresh token comes with it, so the refresher signs in again before the token runs out. The refresh and app-only token requests share one retrying helper. - `--app-only` requires `--user`, conflicts with `--access-token`, and refuses `common`/`organizations`/`consumers` as the tenant. The secret comes from `$INBUXA_MIGRATE_CLIENT_SECRET` or a prompt. - A plan's `clientSecret` now also sets `INBUXA_MIGRATE_CLIENT_SECRET`. Tests: a mockito run checks the token request (grant, client, secret, scope), that every Graph call carries the app token under `/users/{id}`, and that a run without `--user` is refused; CLI and plan unit tests. Not tried against a real tenant: I have no Entra app to test with. Docs list the application permissions to grant.
jcoffey-dev added 1 commit 2026-10-30 21:28:42 +00:00
exchange-graph: app-only sign-in with --app-only
ci / test (pull_request) Skipped
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 3m31s
ci / announce (pull_request) Skipped
74e8445529
The app signs in as itself with its client secret (client credentials,
scope .default) and reads the mailbox --user names, so a whole tenant
moves in a plan with no one signing in. --app-only needs --user and a
real tenant, and reads $INBUXA_MIGRATE_CLIENT_SECRET or prompts. The
token has no refresh token; the refresher signs in again before it runs
out. Token requests share one retrying helper with refresh.

A plan's clientSecret now also sets INBUXA_MIGRATE_CLIENT_SECRET, so it
reaches Graph as well as EWS.
jcoffey-dev merged commit c4e9573c69 into main 2026-10-30 21:32:21 +00:00
jcoffey-dev deleted branch feat/graph-app-only 2026-10-30 21:32:21 +00:00
Sign in to join this conversation.