top of page

What is Access Token?

Oct 27
8 min read

Updated: Oct 28

What is Access Token?

 

An access token is a credential presented to a protected service to request access to a resource. It represents an authorisation granted to a client, often for a particular API, with limits such as scope, intended audience and lifetime depending on the system.

 

A token does not automatically grant access to everything, prove the identity of a person to every application or guarantee that a request will succeed. The resource server must validate the token and decide whether the requested operation is permitted.

 

How does an access token work?

 

In an OAuth 2.0 example, an application obtains authorisation and receives an access token from an authorisation server. The application then presents the token to a resource server, such as an API. The API checks the token and its applicable restrictions before processing a request.

 

The illustration shows a simplified sequence: authorisation, token issuance, a request, validation and expiry or revocation. The exact flow depends on the provider, client type and authorisation grant. Some clients act on behalf of a user; others access resources on their own behalf.

 

Access token infographic showing authorisation, issuance, requests, validation and expiry

 

The OAuth 2.0 framework, RFC 6749, describes the roles of client, resource owner, authorisation server and resource server. OAuth is an authorisation framework; it does not by itself define a complete user login protocol.

 

A practical example

 

Imagine a UK network monitoring application that is allowed to read status information from a broadband provider's API. The provider issues the application a token restricted to the appropriate API and read-only access. The application includes the token when requesting a status report. The API validates it and checks whether the requested operation is allowed.

 

That is an illustrative scenario, not a claim about a particular provider. The actual permission names, token format, expiry and process depend on the provider. A valid read-only token should not be assumed to permit changes to an account or router.

 

Our guide to OAuth explains delegated authorisation. The access control guide explains the separate decision about what an authorised request may do.

 

What information can an access token represent?

 

Concept

What it can indicate

Important qualification

Issuer

Which authority issued the token

The API must trust and validate the issuer

Audience or resource

Which service the token is intended for

A token for one API should not be accepted by another without authorisation

Scope or permissions

The access requested or granted

Scope names and enforcement are provider-specific

Expiry

When a token ceases to be valid under its policy

The service may reject or revoke it earlier

Subject or client

The user, client or other entity associated with a grant

A token does not always represent an individual user

Token binding

Whether additional proof is required

Some tokens are bearer tokens; others are sender-constrained

 

Not every token contains these values in a form the client can read. Some are opaque and require the resource server to ask the authorisation server about their status. The API must enforce the applicable rules rather than simply trusting unverified text in a token.

 

What is a bearer access token?

 

A bearer token can normally be used by whoever possesses it, without separately proving possession of a cryptographic key. That makes the token valuable to an attacker if it leaks. RFC 6750 describes bearer token use and the need to protect tokens in storage and transport.

 

A common HTTP request uses an Authorization header with the scheme Bearer followed by the token value. The word Bearer identifies the scheme; it is not the token itself. Never paste a real token into a public example or support request. TLS protects the token in transit, but does not protect it if it is copied from logs, browser storage, a compromised endpoint or an unsafe backup.

 

Other designs use sender-constrained tokens, requiring proof linked to a key or certificate as well as possession of the token. This reduces some replay risks but does not eliminate compromise if an attacker can also use the associated key or client.

 

Access token vs refresh token, ID token and session token

 

Item

Primary purpose

Where it is normally used

Access token

Authorise access to a protected resource

Presented to the intended API or resource server

Refresh token

Obtain new access tokens when permitted

Sent to the authorisation server, not to the resource API as an access token

OpenID Connect ID token

Communicate an authentication result and claims to the client

Validated by the intended relying party

Session token or cookie

Maintain a session after sign-in

Sent under the application's session rules

API key

Identify or authenticate an application or account according to provider rules

Presented to an API using its documented method

 

These are purposes, not interchangeable formats. An access token may be a JWT or an opaque value. An ID token is intended for the client and must not be treated as a general API access token merely because it contains user claims. A session cookie can be sensitive even though it has a different role.

 

OpenID Connect Core defines an identity layer on OAuth and the ID token. For related concepts see our articles on JWT, session tokens and API keys.

 

Are access tokens always JWTs?

 

No. A JWT is a token format that can carry claims in a structured form. An OAuth access token can be a JWT, but it can also be opaque to the client. The authorisation server and resource server decide how it is issued and validated.

 

A readable JWT payload is not automatically confidential. Base64url encoding is not encryption. A resource server must validate the token according to the relevant profile and trust configuration, including its cryptographic protection where applicable, issuer, audience, time limits and permissions. Merely decoding a token does not prove it is valid.

 

With an opaque token, or where the deployment requires an online status check, an API can use a supported introspection service. RFC 7662 describes how a protected resource can ask an authorisation server whether a token is active and obtain associated metadata. Whether and how it is used depends on the deployment.

 

What is scope?

 

Scope expresses a requested or granted range of access in a provider-defined vocabulary. For example, an API may distinguish reading a status report from changing account settings. The authorisation server may issue a different scope from the one requested, and the resource server must enforce the granted access alongside its own rules.

 

Scope is not a universal list of permissions: the meaning of a scope belongs to the relevant service. A token with a broad scope may still be restricted by the user's privileges, resource ownership, account state or additional policy. Ask for the minimum access the application needs and verify what was actually granted.

 

Why do access tokens expire?

 

A limited lifetime reduces how long an exposed token may be useful and allows a service to reassess access. Lifetimes vary by provider and risk; there is no universal duration. An application may need to obtain a new token or use a refresh token if one was issued and remains valid.

 

Expiry and revocation are related but distinct. A token can expire naturally, while a provider may also revoke a token or its underlying grant. How quickly a revoked token stops working depends on the deployment, including whether the API performs an online status check or accepts a self-contained token until expiry. A new access token is not always available after revocation, and refresh tokens themselves can expire or be revoked.

 

How does an API validate an access token?

 

A resource server should apply the validation rules for its token type and provider. The precise mechanism differs between a locally validated token and an opaque token checked through introspection.

 

  1. Accept tokens only through the documented protected channel and method.

  2. Validate the token's authenticity or active status through the configured mechanism.

  3. Check the trusted issuer, intended audience or resource and applicable time limits.

  4. Check the granted scope and any other restrictions, including sender binding where used.

  5. Apply account, resource ownership and operation-specific authorisation rules.

  6. Reject invalid or insufficient credentials without exposing sensitive token values in logs or error messages.

 

A correct signature alone does not prove a token was intended for this API, has not expired or grants the requested operation. Equally, an active token does not override application-level permissions.

 

Why might an access token be rejected?

 

A rejected request may result from an expired or revoked token, a wrong audience, insufficient scope, an incorrect issuer, an invalid signature or an improperly formatted request. A server can also reject a token when its account, grant or sender binding no longer satisfies policy.

 

Start with the API's documented error response and check that the request is going to the intended endpoint. Verify the token source, time and permissions without disclosing the token. If a refresh token is available, follow the provider's supported renewal flow. If the grant was revoked, the user or administrator may need to authorise again.

 

A network timeout or DNS error occurs at a different layer from a token rejection. Confirm connectivity before resetting a working credential. A session or sign-in can require renewed authentication independently of an API token's lifetime.

 

How should access tokens be protected?

 

  • Use TLS and the provider's recommended transmission method. Avoid placing tokens in URLs, which can appear in logs, browser history and other places.

  • Request narrowly scoped access and restrict tokens to the intended resource where the provider supports it.

  • Keep tokens and refresh tokens out of source code, public repositories, screenshots, analytics and application logs.

  • Protect storage according to the client and threat model. Browser-delivered code and mobile applications cannot be assumed to keep a shared secret hidden from users.

  • Use suitable expiry, revocation and monitoring, and use sender-constrained tokens where supported and appropriate.

  • Treat an exposed bearer token as compromised. Revoke it or its grant where possible, investigate use and issue a replacement through the provider's process.

 

The IETF's OAuth 2.0 Security Best Current Practice, RFC 9700, updates earlier OAuth security guidance. It recommends measures including limiting access token privileges and audience, and addresses sender-constrained tokens and secure refresh token handling. Use a supported OAuth library and the provider's current instructions rather than inventing a custom flow.

 

What should you do if a token is exposed?

 

Use the service's official management interface or incident process to revoke the token or underlying grant where supported. Review the token's permissions, affected resources, application logs and relevant account activity. Replace exposed credentials and investigate where they leaked, including source control history and build logs.

 

Do not assume deleting a token from a file removes copies already captured elsewhere. Check whether the provider also requires refresh token revocation or renewed authorisation, and understand any delay before resource servers reject the old token. Protect incident evidence without copying the token into ordinary support messages.

 

Frequently asked questions

 

Is an access token a password?

 

It is a credential, but it normally represents a particular authorisation rather than the user's reusable account password. A bearer token must still be protected as a secret.

 

Is every access token a JWT?

 

No. An access token may be a JWT or an opaque value, depending on the authorisation server and resource server. An opaque token normally requires a server-side lookup or supported introspection, while a JWT may be validated against trusted keys and claims. The API must follow its issuer's agreed validation contract; detecting a familiar token shape is not authentication.

 

Does an access token identify a person?

 

Not necessarily. It may represent delegated access involving a user or access granted to a client acting on its own behalf. The API must interpret it according to the issuer's rules.

 

Can I use an ID token to call an API?

 

An ID token is intended to communicate an authentication result to the client. Use the access token intended for the API unless the relevant specification explicitly defines another arrangement.

 

Does an expired access token mean the user must sign in again?

 

Not always. A client may obtain another token using an authorised refresh flow, if available and still valid. The provider may nevertheless require renewed authentication or consent.

 

Does revoking a token immediately end every request?

 

Not necessarily. Propagation and validation behaviour depend on the provider and resource server. Some self-contained tokens may remain accepted until expiry unless the deployment checks revocation.

 

Can someone use a stolen access token?

 

A stolen bearer token may be usable by its holder until rejected, expired or revoked. Sender-constrained tokens add a proof requirement, although the associated key or client can also be compromised. Keep it out of URLs, logs and shared screenshots, and send it only to the intended service over protected transport. If exposed, follow the provider's revocation process and verify the API rejects it; deleting the local copy does not invalidate another holder's copy.

 

Key takeaway

 

An access token gives a client a way to present an authorisation to a protected service. Its value depends on correct validation, the intended audience, granted permissions and secure handling. Protect tokens, limit access and use the provider's documented issuance, renewal and revocation processes.

 
 
UK Techie Broadband Providers
bottom of page