C# Class PayPal.OAuthTokenCredential

OAuthTokenCredential is used for generation of OAuth Token used by PayPal REST API service. clientId and clientSecret are required by the class to generate OAuth Token, the resulting token is of the form "Bearer xxxxxx". The class has two constructors, one of it taking an additional Dictionary used for dynamic configuration.
Exibir arquivo Open project: paypal/sdk-core-dotnet Class Usage Examples

Public Methods

Method Description
GetAccessToken ( ) : string

Returns the currently cached access token. If no access token was previously cached, or if the current access token is expired, then a new one is generated and returned.

OAuthTokenCredential ( string clientId, string clientSecret ) : System

Client Id and Secret for the OAuth

OAuthTokenCredential ( string clientId, string clientSecret, string>.Dictionary config ) : System

Client Id and Secret for the OAuth

Private Methods

Method Description
ConvertClientCredentialsToBase64String ( string clientId, string clientSecret ) : string

Covnerts the specified client credentials to a base-64 string for authorization purposes.

GenerateOAuthToken ( string base64ClientId ) : string

Generates a new OAuth token useing the specified client credentials in the authorization request.

Method Details

GetAccessToken() public method

Returns the currently cached access token. If no access token was previously cached, or if the current access token is expired, then a new one is generated and returned.
Thrown if clientId or clientSecret are null or empty. Thrown if there is an issue converting the credentials to a formatted authorization string. Thrown if authorization fails as a result of providing invalid credentials. Thrown if authorization fails and an HTTP error response is received. Thrown if there is an issue attempting to connect to PayPal's services. Thrown if there is an error with any informaiton provided by the . Thrown for any other general exception. See inner exception for further details.
public GetAccessToken ( ) : string
return string

OAuthTokenCredential() public method

Client Id and Secret for the OAuth
public OAuthTokenCredential ( string clientId, string clientSecret ) : System
clientId string
clientSecret string
return System

OAuthTokenCredential() public method

Client Id and Secret for the OAuth
public OAuthTokenCredential ( string clientId, string clientSecret, string>.Dictionary config ) : System
clientId string
clientSecret string
config string>.Dictionary
return System