PHP Class PayPal\Auth\OAuthTokenCredential

Inheritance: extends PayPal\Common\PayPalResourceModel
Show file Open project: paypal/rest-api-sdk-php Class Usage Examples

Public Properties

Property Type Description
$AUTH_HANDLER Default Auth Handler
$CACHE_PATH
$expiryBufferTime integer Private Variable

Public Methods

Method Description
__construct ( string $clientId, string $clientSecret ) Construct
decrypt ( $data ) : string Helper method to decrypt data using clientSecret as key
encrypt ( $data ) : string Helper method to encrypt data using clientSecret as key
getAccessToken ( $config ) : null | string Get AccessToken
getClientId ( ) : string Get Client ID
getClientSecret ( ) : string Get Client Secret
getRefreshToken ( $config, $authorizationCode = null, array $params = [] ) : string | null Get a Refresh Token from Authorization Code
updateAccessToken ( array $config, string | null $refreshToken = null ) : string Updates Access Token based on given input

Protected Methods

Method Description
getToken ( array $config, string $clientId, string $clientSecret, string $payload ) : mixed Retrieves the token based on the input configuration

Private Methods

Method Description
generateAccessToken ( array $config, null | string $refreshToken = null ) : null Generates a new access token

Method Details

__construct() public method

Construct
public __construct ( string $clientId, string $clientSecret )
$clientId string client id obtained from the developer portal
$clientSecret string client secret obtained from the developer portal

decrypt() public method

Helper method to decrypt data using clientSecret as key
public decrypt ( $data ) : string
$data
return string

encrypt() public method

Helper method to encrypt data using clientSecret as key
public encrypt ( $data ) : string
$data
return string

getAccessToken() public method

Get AccessToken
public getAccessToken ( $config ) : null | string
$config
return null | string

getClientId() public method

Get Client ID
public getClientId ( ) : string
return string

getClientSecret() public method

Get Client Secret
public getClientSecret ( ) : string
return string

getRefreshToken() public method

Get a Refresh Token from Authorization Code
public getRefreshToken ( $config, $authorizationCode = null, array $params = [] ) : string | null
$config
$authorizationCode
$params array optional arrays to override defaults
return string | null

getToken() protected method

Retrieves the token based on the input configuration
protected getToken ( array $config, string $clientId, string $clientSecret, string $payload ) : mixed
$config array
$clientId string
$clientSecret string
$payload string
return mixed

updateAccessToken() public method

Updates Access Token based on given input
public updateAccessToken ( array $config, string | null $refreshToken = null ) : string
$config array
$refreshToken string | null
return string

Property Details

$AUTH_HANDLER public static property

Default Auth Handler
public static $AUTH_HANDLER

$CACHE_PATH public static property

public static $CACHE_PATH

$expiryBufferTime public static property

Private Variable
public static int $expiryBufferTime
return integer