We all started somewhere! Share your experience on the Get Advice: Let's Get Started Sweepstakes thread and be entered to win a $100 credit on your Constant Contact account.

Setting config.php for CTCT-OAuth2


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 http://developer.constantcontact.com
$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.




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