Home

Documentation

Documentation

Step 4: Call the Resource

You have an access token from Step 3. Now use it.

Steps 1–3 are identical regardless of what you're calling. Only this step changes. Select the resource type you're targeting:

Calling a REST API

Send the access token as a Bearer token in the Authorization header.

Get All Todos

Get Todo Statistics

Get Completed Todos

Available endpoints

All endpoints require todos.read scope.

MethodPathDescription
GET/api/todosGet all todos
GET/api/todos/completedGet completed todos only
GET/api/todos/incompleteGet incomplete todos only
GET/api/todos/statsGet statistics

Response

JSON

Error handling

These errors apply to both REST and MCP calls.

ErrorCauseFix
401 UnauthorizedToken missing, expired, or invalid signatureRe-run Steps 2–3 to get a fresh token
403 ForbiddenToken valid but scope insufficientCheck scope claim in the decoded access token
406 Not AcceptableMCP only; wrong or missing Accept headerAdd Accept: application/json, text/event-stream
Token refresh strategy

Access tokens expire after ~2 hours. On 401:

  1. If your ID Token is still valid, re-run Step 2 (Token Exchange) then Step 3 (JWT Bearer Grant).
  2. If the ID Token is also expired, the user must re-authenticate (Step 1).

Security considerations

  1. Use the Authorization header: Always send tokens as Authorization: Bearer <token>. Never pass tokens in query strings or URL fragments.
  2. Token refresh: Access tokens expire after ~2 hours. On 401, re-run Steps 2–3 if your ID Token is still valid, or re-authenticate from Step 1 if it has expired.
  3. HTTPS only: Always use HTTPS when calling resource servers in production. Tokens sent over plain HTTP can be intercepted.
  4. Minimal scope: Request only the scopes your application needs. Broader tokens increase the impact of a compromise.

Next step

You've completed the XAA integration guide.

These materials and any recommendations within are not legal, privacy, security, compliance, or business advice. These materials are intended for general informational purposes only and may not reflect the most current security, privacy, and legal developments nor all relevant issues. You are responsible for obtaining legal, security, privacy, compliance, or business advice from your own lawyer or other professional advisor and should not rely on the recommendations herein.

Presented byOkta Developer

Copyright © 2026 Okta. All rights reserved.