Pcornel
Browse topics
Options
Recent
Favorites
Networking · Technical reference

REST API Tokens

Direct answer

Tokens are API credentials whose permissions, audience, lifetime, rotation and revocation must follow the target API contract.

When to use this

Use it when calls start failing with 401 after working earlier (expiry), when deciding token lifetime and storage, or after a token may have leaked.

First 30 seconds

1. Decode the JWT and check iss, aud, exp and scopes.

2. Validate the signature against the issuer's keys.

3. Short-lived access tokens; revoke refresh tokens on compromise.

Operational verification

client authenticates to the token endpoint → short-lived access token issued (scope, audience, expiry) → sent as Bearer on each request → server validates signature, expiry and audience → expired: 401, obtain a new one → revoke on compromise

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
Cisco IOS / IOS XE
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformCisco IOS / IOS XE
Scope / prerequisiteUse it when calls start failing with 401 after working earlier (expiry), when deciding token lifetime and storage, or a…
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

2 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Read-only Verification Verify boundary

Review supported authentication, issuance policy, expiry and revocation behavior without copying live tokens into the reference or command history.

Step 2 Common mistakes Narrow the fault
  • Not validating aud and signature.
  • Storing tokens in browser local storage.
Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Command lookup Jump straight to Cisco syntax
Key points

A syntactically valid token or one successful request does not prove correct scope, audience or revocation enforcement.

Key checks

Decode the token — a JWT is three Base64 parts — and read exp, aud, iss and the scope. Call the API with an expired token → 401. Check where tokens are stored and that they are never written to logs.

ReferenceWhat it is1 section · depth on demand
ReferenceHow it works1 section · depth on demand

Technical Mechanics

Bearer-token possession can be sufficient to use its granted authority. Protect tokens in transit and storage, minimize scope/lifetime where supported, and do not place them in query URLs or shared logs. Generic token guidance does not establish token support on IOS / IOS XE RESTCONF.

ReferenceImportant terms & boundaries4 sections · depth on demand

Proof Boundaries

A syntactically valid token or one successful request does not prove correct scope, audience or revocation enforcement.

In depth

Tokens for REST APIs

Most APIs use bearer tokens. RFC 6750 explains the key property: whoever holds a bearer token can use it, with no proof of possession of a key, so the token must be protected in storage and in transit. Clients should send it in the Authorization: Bearer header; sending it in a URI query parameter is discouraged because URLs are often logged.

Handling rules (RFC 6750)

RuleDetail
TLS alwaysTokens must never cross unencrypted connections; clients validate the server certificate
Header, not URLAuthorization: Bearer <token>
Short lifetimeOne hour or less recommended
Audience restrictionA token for one resource server can't be used at another
No unencrypted cookies or page URLsAvoid leaks through history and logs
IntegrityTokens signed or MAC-protected, or references to unguessable server-side data

Errors (RFC 6750)

ErrorTypical statusMeaning
invalid_request400Malformed request, for example two token methods
invalid_token401Expired, revoked or malformed token
insufficient_scope403Token lacks the required privileges
admin$ curl -s -D - -o /dev/null -H "Authorization: Bearer $OLD_TOKEN" https://ctrl.example.net/api/v1/devices | grep -i -E "^HTTP|www-authenticate"
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer error="invalid_token", error_description="The access token expired"
admin$ jq -R 'split(".") | .[1] | @base64d | fromjson | {iss, aud, exp, scope}' <<< "$TOKEN"
{
  "iss": "https://idp.example.net",
  "aud": "ctrl.example.net",
  "exp": 1764331200,
  "scope": "network.read"
}

Refresh tokens (RFC 6749)

Refresh tokens get new access tokens from the authorization server and are never sent to resource servers. Store them as carefully as passwords.

Threats (RFC 6750)

Token disclosure, replay, manufacture or modification, and redirection to another resource server. TLS, short lifetimes, integrity protection and audience restriction address them.

Documented example, not captured output.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Quick reference

Tokens represent an authenticated session: bearer tokens (anyone holding them can use them), JWTs (signed claims with expiry), refresh tokens (obtain new access tokens).

Good practice: short lifetimes (Catalyst Center tokens expire after 60 minutes), store tokens only in memory or secure stores, never log them, transmit only over TLS, validate signature, issuer, audience and expiry on the server side, and revoke on logout or compromise.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical examples

Configuration & expected output

Concrete examples are shown only when the stored reference contains an actual configuration or output shape for this Topic.

Expected output

JSON Web TokenDecoded JWT payload

Expected state: Issuer, audience, scope and expiry are what the API expects.

{
  "iss": "https://auth.example.net",
  "aud": "network-api",
  "scope": "interfaces:read",
  "exp": 1794700800
}
! Illustrative output, not captured Evidence.
`aud` must name the API being called, `scope` limits what the token may do, and `exp` is the expiry in seconds since 1970. The payload is only encoded, not encrypted — anyone holding the token can read it.
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docCisco IOS / IOS XE Current documentation reviewed 2026-09-14

Authoritative/upstream documentation reviewed for bounded claims in Security → REST API Security → Tokens. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://www.cisco.com/c/en/us/support/ios-nx-os-software/ios-xe-17/series.html · confidence 94%
Confirmation

Confirm action

Continue?