How to use a custom client ID for authentication

Overview

With some CRMs, WP Fusion is registered as an app via those platforms’ developer programs. Because of this, you need an account on our site and a WP Fusion license to complete the initial authentication process with your CRM.

This applies to:

  • BirdSend
  • Drift
  • HubSpot
  • NationBuilder
  • Salesforce (coming soon)
  • Zoho

There may be scenarios where you want to use your own client ID for authentication, and not the WP Fusion client ID. For example if you have a created a custom branded app via your CRM’s developer program, or if you don’t have a WP Fusion license.

Using a custom client ID and authorization URL

The client ID and client secret are public properties on each CRM’s integration class. You can override them by hooking into the wp_fusion_init_crm action. For example with Zoho:

function set_custom_zoho_app() {

	wp_fusion()->crm->client_id        = '1000.XXXXXXXXXXXXXXXXXXXXX';
	wp_fusion()->crm->client_secret_us = '08dccXXXXXXXXXXXXXXXXXXXXX';

}

add_action( 'wp_fusion_init_crm', 'set_custom_zoho_app' );

To override the initial authorization request URI for the “Authorize” button in the WP Fusion settings, use the wpf_{$crm}_auth_url filter, for example with Zoho:

function set_custom_zoho_auth_url() {

	return "https://accounts.zoho.com/oauth/v2/auth?scope=ZohoCRM.modules.ALL,ZohoCRM.settings.ALL,ZohoCRM.users.READ,ZohoCRM.org.READ &response_type=code&access_type=offline&redirect_uri=https%3A%2F%2Fmysite.com%2Fzoho.php&prompt=consent&client_id=XXXX";

}

add_action( 'wpf_zoho_auth_url', 'set_custom_zoho_auth_url' );

Note that in this example you must have registered https://mysite.com/zoho.php as the redirect URI for your app, and must have a script running at that location which is capable of listening for the authorization response and redirecting back to the WP Fusion settings page with the &code= parameter in the URL.

Was this helpful?