---
title: OAuth2Context
description: Provides OAuth 2.0 access tokens. When the OAuth2ResourceServerFilter processes a request, it injects the access token into this context.
component: pinggateway
version: 7.2
page_id: pinggateway:reference:OAuth2Context
canonical_url: https://docs.pingidentity.com/pinggateway/2026/reference/OAuth2Context.html
llms_txt: https://docs.pingidentity.com/pinggateway/llms.txt
docs_for_agents: https://developer.pingidentity.com/build-with-ai/docs-for-agents.md
revdate: 2025-06-02T16:30:54Z
superseded_by: https://docs.pingidentity.com/pinggateway/2026/reference/OAuth2Context.html
section_ids:
  OAuth2Context-properties: Properties
  OAuth2Context-moreinfo: More information
---

# OAuth2Context

Provides OAuth 2.0 access tokens. When the [OAuth2ResourceServerFilter](Filters.html#OAuth2ResourceServerFilter) processes a request, it injects the access token into this context.

## Properties

The context name is `oauth2`, and is accessible at `${contexts.oauth2}`. The context has the following properties:

* `"accessToken"`: AccessTokenInfo

  The AccessTokenInfo is built from the following properties:

  * `"info"`: (map\<string>, object)

    Raw JSON as a map.

  * `"token"`: [string](preface.html#definition-string)

    Access token identifier issued from the authorization server.

  * `"scopes"`: space separated [string](preface.html#definition-string)

    Scopes associated to this token.

  * `"expiresAt"`: long

    Timestamp (in milliseconds since epoch) when the token expires.

## More information

[org.forgerock.http.oauth2.OAuth2Context](../_attachments/apidocs/org/forgerock/http/oauth2/OAuth2Context.html)

[org.forgerock.http.oauth2.AccessTokenInfo](../_attachments/apidocs/org/forgerock/http/oauth2/AccessTokenInfo.html)
