new OAuth2(options)
OAuth2 class
Parameters:
Name |
Type |
Description |
options |
Object
|
OAuth2 config options
Properties
Name |
Type |
Attributes |
Description |
loginUrl |
String
|
<optional>
|
Salesforce login server URL |
authzServiceUrl |
String
|
<optional>
|
OAuth2 authorization service URL. If not specified, it generates from default by adding to login server URL. |
tokenServiceUrl |
String
|
<optional>
|
OAuth2 token service URL. If not specified it generates from default by adding to login server URL. |
clientId |
String
|
|
OAuth2 client ID. |
clientSecret |
String
|
|
OAuth2 client secret. |
redirectUri |
String
|
|
URI to be callbacked from Salesforce OAuth2 authorization service. |
|
- Source:
Methods
authenticate(username, password, callbackopt) → {Promise.<TokenResponse>}
OAuth2 Username-Password Flow (Resource Owner Password Credentials)
Parameters:
Name |
Type |
Attributes |
Description |
username |
String
|
|
Salesforce username |
password |
String
|
|
Salesforce password |
callback |
Callback.<TokenResponse>
|
<optional>
|
Callback function |
- Source:
Returns:
-
Type
-
Promise.<TokenResponse>
getAuthorizationUrl(params) → {String}
Get Salesforce OAuth2 authorization page URL to redirect user agent.
Parameters:
Name |
Type |
Description |
params |
Object
|
Parameters
Properties
Name |
Type |
Description |
scope |
String
|
Scope values in space-separated string |
state |
String
|
State parameter |
|
- Source:
Returns:
Authorization page URL
-
Type
-
String
refreshToken(refreshToken, callbackopt) → {Promise.<TokenResponse>}
OAuth2 Refresh Token Flow
Parameters:
Name |
Type |
Attributes |
Description |
refreshToken |
String
|
|
Refresh token |
callback |
Callback.<TokenResponse>
|
<optional>
|
Callback function |
- Source:
Returns:
-
Type
-
Promise.<TokenResponse>
OAuth2 Web Server Authentication Flow (Authorization Code)
Access Token Request
Parameters:
Name |
Type |
Attributes |
Description |
code |
String
|
|
Authorization code |
callback |
Callback.<TokenResponse>
|
<optional>
|
Callback function |
- Source:
Returns:
-
Type
-
Promise.<TokenResponse>
revokeToken(accessToken, callbackopt) → {Promise.<undefined>}
OAuth2 Revoke Session Token
Parameters:
Name |
Type |
Attributes |
Description |
accessToken |
String
|
|
Access token to revoke |
callback |
Callback.<undefined>
|
<optional>
|
Callback function |
- Source:
Returns:
-
Type
-
Promise.<undefined>