public final class OAuthTokenCredential extends Object implements ICredential
PayPalResource for configuring the system.
When using a configuration map the class expects an entry by the name
"oauth.EndPoint" or "service.EndPoint" to retrieve the value of the endpoint
for the OAuth Service. If either are not present the configuration should
have a entry by the name "mode" with values sandbox or live wherein the
corresponding endpoints are default to PayPal endpoints.| Constructor and Description |
|---|
OAuthTokenCredential(String clientID,
String clientSecret) |
OAuthTokenCredential(String clientID,
String clientSecret,
Map<String,String> configurationMap)
Configuration Constructor for dynamic configuration
|
| Modifier and Type | Method and Description |
|---|---|
long |
expiresIn()
Specifies how long this token can be used for placing API calls.
|
String |
getAccessToken()
Computes Access Token by placing a call to OAuth server using ClientID
and ClientSecret.
|
String |
getAuthorizationHeader()
Computes Access Token by doing a Base64 encoding on the ClientID and
ClientSecret.
|
protected String |
getRequestPayload()
Returns the request payload for OAuth Service.
|
static void |
setOAUTH_TOKEN_PATH(String oauthTokenPath)
Sets the URI path for the OAuth Token service.
|
public OAuthTokenCredential(String clientID, String clientSecret)
clientID - Client ID for the OAuthclientSecret - Client Secret for OAuthpublic OAuthTokenCredential(String clientID, String clientSecret, Map<String,String> configurationMap)
clientID - Client ID for the OAuthclientSecret - Client Secret for OAuthconfigurationMap - Dynamic configuration map which should have an entry for
'oauth.EndPoint' or 'service.EndPoint'. If either are not
present then there should be entry for 'mode' with values
sandbox/live, wherein PayPals endpoints are used.public static void setOAUTH_TOKEN_PATH(String oauthTokenPath)
oauthTokenPath - the URI part to setpublic String getAccessToken() throws PayPalRESTException
PayPalRESTExceptionpublic String getAuthorizationHeader() throws PayPalRESTException
PayPalRESTExceptionpublic long expiresIn()
protected String getRequestPayload()
Copyright © 2016. All Rights Reserved.