The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

Setting config.php for CTCT-OAuth2

Occasional Visitor

Setting config.php for CTCT-OAuth2

I need help with setting up the config.php file to work correctly with the ConstantContact.php class library. I have the user name and password for the account that I want to send emails to and I have created an API Key and Consumer Secret linked to that account.


The config.php file says:


 * If you already have the credentials, you would not need to store
 * them into the DataStore object.  You can set them here
 * locally like so:
 * $username = "username";
 * $accessToken = "access token";

// Constant Contact API key, obtain one at
$apikey = "";

// Consumer secret is issued with an apikey
$consumersecret = "";

// Redirect URL which is set when creating your API key, this must match up
// or you will receive an error
$verificationURL = '';

// This URL will be used in the example_verification to bounce back to wherever
// you like.  This would be a way to send back to where the user started
$returnURL = '';


How do I get an access token and Redirect URL? It appears that I need these. Do I?

It also appears that the script will still try to run the DataStore object even if I have these -- is there a patched version of config.php available for a simple 1 account customer -- all I want to do is add contact emails gathered from the customer site.


Thanks for your help.

Regular Advisor

Re: Setting config.php for CTCT-OAuth2



You do need both the redirect and access token.  The access token can be generated at the I/O doc page here:


Just click on the button labeled "Get Access Token" and follow the instructions to generate it.  The redirect URL needs to match the one used when you applied for the api key on Mashery.  Hope that helps.




Andrew B.

API Support

Developer Portal

View API documentation, code samples, get your API key.

Visit Page

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More