Creating a Custom OAuth App
If you do not have access to the user name and password or do not wish to require them, you can use OAuth authentication. Pipedrive uses the OAuth authentication standard, which requires the authenticating user to interact with Pipedrive via the browser. The driver facilitates the OAuth exchange in various ways, as described in this section.
Create a Connected App
To obtain the OAuth client credentials, client id, and client secret:
- First, login in your Pipedrive account Login Page. After login, go to the Settings page by choosing Tools and integrations from the drop-down menu.
- Click Marketplace Manager in the left menu.
- Click the Create new app button.
- Click the yes or no button.
- Enter all the required items and enter a value in the Redirect URI box. If you are making a desktop application, set the Callback URL to http://localhost:33333 or a different port number of your choice. If you are making a web application, set the Callback URL to a page on your Web app that you want the user to be returned to after they have authorized your application.
- Click the save button in top right menu after you complete entry. Check your entries on the confirmation screen and click Add a new button if everything OK.
- Enabled applications are displayed in the list and the process completes. The OAuthClientId and ClientSecret will be displayed along with the information entered on the process above.
Authenticate to Pipedrive from a Desktop Application
After setting the following connection properties, you are ready to connect:
- OAuthClientId: Set to the client key in your app settings.
- OAuthClientSecret: Set to the client secret in your app settings.
- CallbackURL: Set to the callback URL in your app settings.
- InitiateOAuth: Set to GETANDREFRESH. You can use InitiateOAuth to avoid repeating the OAuth exchange and manually setting the OAuthAccessToken connection property.
When you connect, the driver opens the OAuth endpoint in your default browser. Log in and grant permissions to the application. The driver then completes the following OAuth process:
- Gets the callback URL and sets the access token.
- Saves OAuth values in OAuthSettingsLocation to be persisted across connections.
- Exchanges the returned refresh token for a new, valid access token.
Authenticate to Pipedrive from a Web Application
To obtain the access token, set the following connection properties:
- OAuthClientId: Set to the client key in your app settings.
- OAuthClientSecret: Set to the client secret in your app settings.
- CallbackURL: Set to the callback URL in your app settings.
When connecting via a web application, or if the driver is not authorized to open a browser window, you need to exchange temporary verification values for the access token:
- Call GetOAuthAuthorizationURL. The stored procedure returns the URL to the OAuth endpoint.
- Log in and authorize the application. You are redirected back to the callback URL. If you set the GrantType parameter to Implicit, the callbackURL contains the OAuthAccessToken in a query string parameter. If you set the GrantType parameter to code, the callback URL contains the verifier code in the query string parameter named "code". Extract the verifier code and call .
To connect to data, set the following connection properties:
- OAuthAccessToken
To automatically refresh the access token when it expires, set InitiateOAuth to REFRESH and set OAuthRefreshToken. Alternatively, call the RefreshOAuthAccessToken stored procedure when the access token expires. Given a refresh token as input, the procedure returns a valid OAuth access token.