cancel
Showing results for 
Search instead for 
Did you mean: 

Failure to authenticate when trying to make API calls

SOLVED
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.

4 REPLIES 4
CTCT 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

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?

CTCT 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

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.