Widen the granted scope of an already-linked provider
POST/api/auth/oauth/{provider}/elevate
elevateOauthScope
Session-authenticated caller only (no sudo). Re-runs the OAuth handshake for a provider ALREADY linked to the account to widen its granted scope — e.g. add `repo` for private-repo import (set `requested_scope: "repo"`). Refuses if the provider isn't linked yet (use the sudo-gated `/link` flow to add a new identity), and the **callback refuses any provider account this neosource account has not already linked** — elevation widens an existing link, it never attaches a new identity. The provider's own consent screen still gates the grant, so this can't silently widen access. **Every bearer access token — including unrestricted and legacy tokens — is refused** with `403 { error: "forbidden" }` before the handshake starts (ADR 0069 §6): the handshake ends in a session cookie, which carries no token grant.
Requires authentication using a session cookie — see tokens and scopes.
curl
curl -X POST 'https://neosource.dev/api/auth/oauth/PROVIDER/elevate' \
-b 'ns_session=$NEOSOURCE_SESSION' \
-H 'Content-Type: application/json' \
-d '{"intent":"string"}'fetch
fetch("https://neosource.dev/api/auth/oauth/PROVIDER/elevate", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
credentials: "include",
body: JSON.stringify({"intent":"string"}),
});Path parameters
providerrequiredOne of: `github`. Extend as more providers come online.
Request bodyrequired
application/json
Responses
200Redirect URL
application/json
Standard errors
Bodies documented once for the whole API — see standard errors.
- 400Bad Request — one of: invalid_input
- 401Authentication required
- 403Forbidden — one of: forbidden
- 429Rate limited — retry after the `Retry-After` header
- 500Internal server error
- 502Bad Gateway — one of: upstream
- 503Service temporarily unavailable / at capacity — retry after the `Retry-After` header
- 504Gateway timeout — the request exceeded the server's handling budget