googleauth - Class Google::Auth::OAuth2::STSClient (v1.15.0)

Reference documentation and code samples for the googleauth class Google::Auth::OAuth2::STSClient.

OAuth 2.0 Token Exchange Spec.This module defines a token exchange utility based on theOAuth 2.0 Token Exchange spec. This will be mainlyused to exchange external credentials for GCP access tokens in workload identity pools toaccess Google APIs.The implementation will support various types of client authentication as allowed in the spec.

A deviation on the spec will be for additional Google specific options that cannot be easilymapped to parameters defined in the RFC.The returned dictionary response will be based on therfc8693 section 2.2.1 spec JSON response.

Inherits

  • Object

Methods

#exchange_token

defexchange_token(options={})->Hash

Exchanges the provided token for another type of token based on therfc8693 spec

A callable faraday instance used to make HTTP requests.

Parameters
  • connection (Faraday instance)
  • grant_type (String) — The OAuth 2.0 token exchange grant type.
  • subject_token (String) — The OAuth 2.0 token exchange subject token.
  • subject_token_type (String) — The OAuth 2.0 token exchange subject token type.
  • resource (String) — The optional OAuth 2.0 token exchange resource field.
  • audience (String) — The optional OAuth 2.0 token exchange audience field.
  • scopes (Array<String>) — The optional list of scopes to use.
  • requested_token_type (String) — The optional OAuth 2.0 token exchange requested token type.
  • additional_headers (Hash<String,String>) — :The optional additional headers to pass to the token exchange endpoint.
Returns
  • (Hash) — A hash containing the token exchange response.
Raises

#initialize

definitialize(options={})->STSClient

Create a new instance of the STSClient.

Parameter
  • options (Hash) — Configuration options
Returns
Raises

Constants

URLENCODED_HEADERS

value:{ "Content-Type": "application/x-www-form-urlencoded" }.freeze

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-10-30 UTC.