Ads API .NET library
|
Default implementation of OAuth2 provider. More...
Public Member Functions | |
AdsOAuthProviderImpl (AppConfig config) | |
Initializes a new instance of the AdsOAuthProvider class. More... | |
string | GetAuthorizationUrl () |
Gets the authorization URL. More... | |
bool | FetchAccessAndRefreshTokens (string authorizationCode) |
Fetches the access and optionally the refresh token if applicable. More... | |
void | RevokeRefreshToken () |
Revokes the refresh token if offline mode is used. More... | |
void | RefreshAccessToken () |
Refreshes the access token if expiring. More... | |
void | RefreshAccessTokenInOfflineMode () |
Refreshes the access token if offline mode is used. More... | |
void | GenerateAccessTokenForServiceAccount () |
Generates the access token for service account. More... | |
void | RefreshAccessTokenIfExpiring () |
Refreshes the access token if expiring. More... | |
virtual string | GetAuthHeader () |
Gets the OAuth authorization header to be used with HTTP requests. More... | |
Protected Member Functions | |
virtual string | CreateAuthorizationUrl () |
Creates the authorization URL. More... | |
virtual TokenResponse | ExchangeCodeForToken (string code) |
Exchanges the authorization code for access and refresh tokens. More... | |
virtual TokenResponse | GetAccessTokenForAuthorizationCodeFlow () |
Refreshes the access token in authorization code flow. More... | |
virtual TokenResponse | GetAccessTokenForServiceAccount () |
Gets the access token in service account flow. More... | |
virtual void | RevokeRefreshToken (string refreshToken) |
Revokes the refresh token asynchronously. More... | |
Protected Attributes | |
readonly AdsFeatureUsageRegistry | featureUsageRegistry |
The registry for saving feature usage information.. More... | |
Properties | |
IHttpClientFactory | HttpClientFactory [get, set] |
The HttpClientFactory used for requesting access tokens. More... | |
IClock | Clock [get, set] |
The clock used for requesting access tokens. More... | |
AppConfig | Config = SystemClock.Default [get] |
Gets the application configuration class for this object. More... | |
string | ClientId [get, set] |
Gets or sets the client that is making the request. This value is obtained from the Google Cloud Console during application registration. More... | |
string | ClientSecret [get, set] |
Gets or sets the client secret obtained from the Google Cloud Console during application registration. More... | |
string | Scope [get, set] |
Gets or sets the API access your application is requesting. This is space delimited. More... | |
string | State [get, set] |
Gets or sets a parameter that your application can use for keeping state. The OAuth authorization server roundtrips this parameter. More... | |
string | TokenType [get] |
Gets the type of token returned by the server. This field will always have the value Bearer for now. More... | |
string | AccessToken [get, set] |
Gets or sets the token that can be sent to a Google API for authentication. More... | |
DateTime | UpdatedOn [get, set] |
Gets or sets the time at which access token was retrieved. More... | |
int | ExpiresIn [get, set] |
Gets the remaining lifetime on the access token. More... | |
OAuthTokensObtainedCallback | OnOAuthTokensObtained [get, set] |
Callback triggered when this provider obtains a new access token or refresh token from the OAuth server. More... | |
bool | IsOffline [get, set] |
Indicates if your application needs to access APIs when the user is not present at the browser. This is defaulted to true. More... | |
string | RedirectUri = true [get, set] |
Gets or sets where the url where the response is sent. This should be a registered redirect uri on the Google Cloud Console. More... | |
string | RefreshToken [get, set] |
Gets or sets a token that may be used to obtain a new access token. Refresh tokens are valid until the user revokes access. More... | |
string | ServiceAccountEmail [get] |
Gets the service account email for which access token should be retrieved. More... | |
string | PrnEmail [get, set] |
Gets or sets the email of the account for which the call is being made. More... | |
string | JwtPrivateKey [get] |
Gets or sets the JWT private key. More... | |
![]() | |
string | ServiceAccountEmail [get] |
Gets the service account email for which access token should be retrieved. More... | |
string | PrnEmail [get, set] |
Gets or sets the email of the account for which the call is being made. More... | |
![]() | |
string | ClientId [get, set] |
Gets or sets the client that is making the request. This value is obtained from the API console during application registration. More... | |
string | ClientSecret [get, set] |
Gets or sets the client secret obtained from the API console during application registration.during application registration. More... | |
string | Scope [get, set] |
Gets or sets the API access your application is requesting. This is space delimited. More... | |
string | State [get, set] |
Gets or sets a parameter that your application can use for keeping state. The OAuth Authorization Server roundtrips this parameter. More... | |
string | TokenType [get] |
Gets the type of token returned by the server. This field will always have the value Bearer for now. More... | |
string | AccessToken [get, set] |
Gets or sets the token that can be sent to a Google API for authentication. More... | |
DateTime | UpdatedOn [get, set] |
Gets or sets the time at which access token was retrieved. More... | |
int | ExpiresIn [get, set] |
Gets the remaining lifetime on the access token. More... | |
OAuthTokensObtainedCallback | OnOAuthTokensObtained [get] |
Callback triggered when this provider obtains a new access token or refresh token from the OAuth server. More... | |
![]() | |
AppConfig | Config [get] |
Gets the application configuration class for this object. More... | |
![]() | |
bool | IsOffline [get, set] |
Indicates if your application needs to access APIs when the user is not present at the browser. This is defaulted to true. More... | |
string | RedirectUri [get, set] |
Gets or sets where the url where the response is sent. This should be a registered redirect uri on the API console. More... | |
string | RefreshToken [get, set] |
Gets or sets a token that may be used to obtain a new access token. Refresh tokens are valid until the user revokes access. More... | |
Default implementation of OAuth2 provider.
|
inline |
Initializes a new instance of the AdsOAuthProvider class.
config | The configuration. |
|
inlineprotectedvirtual |
Creates the authorization URL.
|
inlineprotectedvirtual |
Exchanges the authorization code for access and refresh tokens.
code | The authorization code. |
|
inline |
Fetches the access and optionally the refresh token if applicable.
authorizationCode | The authorization code returned by OAuth server. |
Implements Google.Api.Ads.Common.Lib.AdsOAuthProviderForApplications.
|
inline |
Generates the access token for service account.
Implements Google.Api.Ads.Common.Lib.AdsOAuthProviderForServiceAccounts.
|
inlineprotectedvirtual |
Refreshes the access token in authorization code flow.
|
inlineprotectedvirtual |
Gets the access token in service account flow.
|
inlinevirtual |
Gets the OAuth authorization header to be used with HTTP requests.
Implements Google.Api.Ads.Common.Lib.AdsOAuthProvider.
|
inline |
Gets the authorization URL.
Implements Google.Api.Ads.Common.Lib.AdsOAuthProviderForApplications.
|
inline |
Refreshes the access token if expiring.
Implements Google.Api.Ads.Common.Lib.AdsOAuthProvider.
|
inline |
Refreshes the access token if expiring.
Implements Google.Api.Ads.Common.Lib.AdsOAuthProvider.
|
inline |
Refreshes the access token if offline mode is used.
Implements Google.Api.Ads.Common.Lib.AdsOAuthProviderForApplications.
|
inline |
Revokes the refresh token if offline mode is used.
Implements Google.Api.Ads.Common.Lib.AdsOAuthProviderForApplications.
|
inlineprotectedvirtual |
Revokes the refresh token asynchronously.
refreshToken | The refresh token. |
|
protected |
The registry for saving feature usage information..
|
getset |
Gets or sets the token that can be sent to a Google API for authentication.
|
getset |
Gets or sets the client that is making the request. This value is obtained from the Google Cloud Console during application registration.
|
getset |
Gets or sets the client secret obtained from the Google Cloud Console during application registration.
|
getset |
The clock used for requesting access tokens.
|
get |
Gets the application configuration class for this object.
|
getset |
Gets the remaining lifetime on the access token.
|
getset |
The HttpClientFactory used for requesting access tokens.
|
getset |
Indicates if your application needs to access APIs when the user is not present at the browser. This is defaulted to true.
|
get |
Gets or sets the JWT private key.
|
getset |
Callback triggered when this provider obtains a new access token or refresh token from the OAuth server.
|
getset |
Gets or sets the email of the account for which the call is being made.
|
getset |
Gets or sets where the url where the response is sent. This should be a registered redirect uri on the Google Cloud Console.
|
getset |
Gets or sets a token that may be used to obtain a new access token. Refresh tokens are valid until the user revokes access.
|
getset |
Gets or sets the API access your application is requesting. This is space delimited.
|
get |
Gets the service account email for which access token should be retrieved.
|
getset |
Gets or sets a parameter that your application can use for keeping state. The OAuth authorization server roundtrips this parameter.
|
get |
Gets the type of token returned by the server. This field will always have the value Bearer for now.
|
getset |
Gets or sets the time at which access token was retrieved.