Skip to content

getOauthInfo

This method returns a simple object containing all necessary OAuth values. This method provides developers with a safe and secure way to present to the framework values that are typically considered private, for example a client secret. These values are often stored in environment variables or in a vault.

Input parameters

None.

Return value(s)

This method should return an associative array with the following keys and values:

Key Value
clientId The client ID of the application registered with the CRM provider, used to call the CRM's API.
clientSecret The client secret of the application registered with the CRM provider.
accessTokenUri The API endpoint used to retrieve the access token from the CRM provider.
redirectUri The redirect URI registered with the CRM provider.

Example

{
  'clientId': 'xxx-xxxx-xxxxxxxxxx-xxxx',
  'clientSecret': 'xxxxxxxx-xxxxxxxxxxxxxxxxxx',
  'accessTokenUri': 'https://auth.crm.com/token',
  'redirectUri': 'https://ringcentral.github.io/ringcentral-embeddable/redirect.html'
}

Reference

// async function getOauthInfo() {
//     return {
//         clientId: process.env.TEST_CRM_CLIENT_ID,
//         clientSecret: process.env.TEST_CRM_CLIENT_SECRET,
//         accessTokenUri: process.env.TEST_CRM_TOKEN_URI,
//         redirectUri: process.env.TEST_CRM_REDIRECT_URI
//     }
// }
async function getOauthInfo() {
    return {
        clientId: process.env.PIPEDRIVE_CLIENT_ID,
        clientSecret: process.env.PIPEDRIVE_CLIENT_SECRET,
        accessTokenUri: process.env.PIPEDRIVE_ACCESS_TOKEN_URI,
        redirectUri: process.env.PIPEDRIVE_REDIRECT_URI
    }
}