|
| 1 | +# Okta Example Notes |
| 2 | + |
| 3 | +This note covers running the Okta delegation compatibility demo and fixing the |
| 4 | +most common setup issues. |
| 5 | + |
| 6 | +## Prerequisites |
| 7 | + |
| 8 | +- Populate `AgentIdentity/.env` with: |
| 9 | + - `OKTA_ISSUER` |
| 10 | + - `OKTA_CLIENT_ID` |
| 11 | + - `OKTA_CLIENT_SECRET` |
| 12 | + - `OKTA_AUDIENCE` |
| 13 | + - `OKTA_SCOPE` (defaults to `authority:check`) |
| 14 | +- Load env vars in your terminal: |
| 15 | + |
| 16 | +```bash |
| 17 | +set -a |
| 18 | +source .env |
| 19 | +set +a |
| 20 | +``` |
| 21 | + |
| 22 | +## Run the compatibility demo |
| 23 | + |
| 24 | +```bash |
| 25 | +python examples/delegation/okta_obo_compat_demo.py \ |
| 26 | + --issuer "$OKTA_ISSUER" \ |
| 27 | + --client-id "$OKTA_CLIENT_ID" \ |
| 28 | + --client-secret "$OKTA_CLIENT_SECRET" \ |
| 29 | + --audience "$OKTA_AUDIENCE" \ |
| 30 | + --scope "${OKTA_SCOPE:-authority:check}" |
| 31 | +``` |
| 32 | + |
| 33 | +If your tenant supports token exchange/OBO, add: |
| 34 | + |
| 35 | +```bash |
| 36 | +--supports-token-exchange |
| 37 | +``` |
| 38 | + |
| 39 | +Full command: |
| 40 | + |
| 41 | +```bash |
| 42 | +python examples/delegation/okta_obo_compat_demo.py \ |
| 43 | + --issuer "$OKTA_ISSUER" \ |
| 44 | + --client-id "$OKTA_CLIENT_ID" \ |
| 45 | + --client-secret "$OKTA_CLIENT_SECRET" \ |
| 46 | + --audience "$OKTA_AUDIENCE" \ |
| 47 | + --scope "$OKTA_SCOPE" \ |
| 48 | + --supports-token-exchange |
| 49 | +``` |
| 50 | + |
| 51 | +## Common error: `invalid_scope` |
| 52 | + |
| 53 | +Error example: |
| 54 | + |
| 55 | +```text |
| 56 | +HTTP 400 ... {"error":"invalid_scope","error_description":"One or more scopes are not configured for the authorization server resource."} |
| 57 | +``` |
| 58 | + |
| 59 | +This means the requested scope (for example `authority:check`) is not configured |
| 60 | +for your Okta authorization server. |
| 61 | + |
| 62 | +### Fix |
| 63 | + |
| 64 | +1. In Okta Admin, open `Security -> API -> Authorization Servers -> default`. |
| 65 | +2. Add scope `authority:check` (or another scope you intend to use). |
| 66 | +3. In Access Policies, allow: |
| 67 | + - grant type: `Client Credentials` |
| 68 | + - scope: `authority:check` (or your chosen scope) |
| 69 | +4. Re-run the demo. |
| 70 | + |
| 71 | +If you want a quick workaround, set `OKTA_SCOPE` to an existing scope that your |
| 72 | +app policy already allows. |
| 73 | + |
| 74 | +## Compatibility behavior |
| 75 | + |
| 76 | +- If `--supports-token-exchange` is set and tenant supports it: |
| 77 | + - output should report `delegation_path: idp_token_exchange`. |
| 78 | +- Otherwise: |
| 79 | + - output should report `delegation_path: authority_mandate_delegation`. |
| 80 | + |
| 81 | +This keeps delegation deterministic even when IdP-native OBO is unavailable. |
0 commit comments