cancel
Showing results for 
Search instead for 
Did you mean: 

Help with API authentication

TTP
Regular Visitor

Help with API authentication

After reading several posts here and the available documentation I am still a bit confused as to how to set up an API token allowing me to link our web app with a Constant Contact account. 

 

What I am investigating here is how to link our CRM web app to a subscribers Constant Contact account so they can send customer records via the API to Constant Contact for use in email marketing. 

 

Is their a way our customer can create a token that we can then store for use later? This is where I am lost with the Mashable / OAuth concept of how a Constant Contact client can give us a token for API use. 

 

Thanks, 

Tim 

1 REPLY 1
Highlighted
CTCT Employee

Re: Help with API authentication

Hi Tim,
Yes, using OAuth you can have users login with their Constant Contact credentials and then an OAuth token will be passed back to you.  You would then just store this token and use it when communicating with their account.

The first step to using OAuth is to make sure you have the proper redirect URI setup for your application.  You will want it to be either your domain (http://www.yoursite.com/) or even the script that would store the OAuth token (although if you just put the domain you will be able to use multiple pages/ change this dyanmically).

You can then direct users to the following URL  for them to login (replacing the placeholder for the API key and the Redirect URI with the proper values):

 

]https://oauth2.constantcontact.com/oauth2/oauth/siteowner/authorize?response_type=token&client_id=<your_API_KEY>&redirect_uri=<your_encoded_redirect_URI>

Once the user logs in and grants your application privileges to access their account you'll receive a JSON response back on the Redirect URI that should look something like this:

 

{
 "access_token":"a46950a6-7cad-413a-8183-550756d096f4",
 "expires_in":315359999,
 "token_type":"Bearer"
}


Again, just store that token and you will be able to use that for connecting to their account through the API.

Hopefully that makes sense, and if not feel free to contact me or API Support directly and we will be more than happy to assist you!

Thanks,
Mike

-------------------------------------------
Check out our developer portal: http://developer.constantcontact.com