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.

Failure to authenticate when trying to make API calls

SOLVED
Go to solution
Highlighted
Occasional Participant

Failure to authenticate when trying to make API calls

I'm trying to access the CC api for a client with a single account.  I've used the mashery service to get an API Key for the client (using their CC acount) and generated an Access Code.  I've tried using the php library (https://github.com/constantcontact/ctct_php_library) and the wrapper (cc_class.php) class found here (https://github.com/constantcontact/Constant-Contact-PHP-Sample-Contact-Forms).  

 

In both cases I was unable to authenticate even though I'm using the correct username (the client's), api key, and access key.  When using the ctct_php_library I get a 'username not found in datastore' error, and when I use the cc_class I get a 401 error.

 

I'm at a loss and would appreciate any help.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Employee

Re: Failure to authenticate when trying to make API calls

I see.  You can still generate a V1 API Key here, and if you want to use OAuth2 (I'd recommend it), you can download this OAuth2 example on Github to generate an access token for it.  Just out of curiosity, is there something preventing you from downloading a newer version of PHP?  The software should be free.

 

Best Regards,

Shannon W.

API Support Specialist

View solution in original post

4 REPLIES 4
Highlighted
Employee

Re: Failure to authenticate when trying to make API calls

Hi,

 

The problem is probably that you're using a V2 (Mashery) APi Key with V1 wrappers.  You can use any of our V2 wrappers with your existing key, like those listed on this page.

 

Best Regards,

Shannon W.

API Support Specialist

Highlighted
Occasional Participant

Re: Failure to authenticate when trying to make API calls

Thanks for the reply.

 

The new sdk looks really spiffy, but it requires php 5.3+ and we're running 5.2.9.  Is there a way to generate a an acces key for the older version?

Highlighted
Employee

Re: Failure to authenticate when trying to make API calls

I see.  You can still generate a V1 API Key here, and if you want to use OAuth2 (I'd recommend it), you can download this OAuth2 example on Github to generate an access token for it.  Just out of curiosity, is there something preventing you from downloading a newer version of PHP?  The software should be free.

 

Best Regards,

Shannon W.

API Support Specialist

View solution in original post

Highlighted
Occasional Participant

Re: Failure to authenticate when trying to make API calls

Thanks.  I've generated a V1 key and things are working.

 

Re: PHP Version - I don't have control of the server that the code runs on.  The sysadmin who runs the server is currently swamped and I need to get this stuff up and running ASAP.

 

Thanks again for your help.

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
Featured