Package cloud.google.com/go/auth/oauth2adapt (v0.2.8)

Note: To get more information about this package, such as access to older versions, viewthis package on pkg.go.dev.

Package oauth2adapt helps converts types used incloud.google.com/go/authandgolang.org/x/oauth2.

Functions

func AddRetrieveErrorToAuthError

funcAddRetrieveErrorToAuthError(err*auth.Error)*auth.Error

AddRetrieveErrorToAuthError returns the same error provided and adds a[golang.org/x/oauth2.RetrieveError] to the error chain by setting theErr field on the[cloud.google.com/go/auth.Error].

func AuthCredentialsFromOauth2Credentials

funcAuthCredentialsFromOauth2Credentials(creds*google.Credentials)*auth.Credentials

AuthCredentialsFromOauth2Credentials converts a [golang.org/x/oauth2/google.Credentials]to a [cloud.google.com/go/auth.Credentials].

func AuthErrorFromRetrieveError

funcAuthErrorFromRetrieveError(err*oauth2.RetrieveError)*auth.Error

AuthErrorFromRetrieveError returns an [cloud.google.com/go/auth.Error] thatwraps the provided [golang.org/x/oauth2.RetrieveError].

func Oauth2CredentialsFromAuthCredentials

funcOauth2CredentialsFromAuthCredentials(creds*auth.Credentials)*google.Credentials

Oauth2CredentialsFromAuthCredentials converts a [cloud.google.com/go/auth.Credentials]to a [golang.org/x/oauth2/google.Credentials].

func TokenProviderFromTokenSource

funcTokenProviderFromTokenSource(tsoauth2.TokenSource)auth.TokenProvider

TokenProviderFromTokenSource converts any [golang.org/x/oauth2.TokenSource]into a [cloud.google.com/go/auth.TokenProvider].

func TokenSourceFromTokenProvider

funcTokenSourceFromTokenProvider(tpauth.TokenProvider)oauth2.TokenSource

TokenSourceFromTokenProvider converts any[cloud.google.com/go/auth.TokenProvider] into a[golang.org/x/oauth2.TokenSource].

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.