Join our Ask A Trainer Sessions and Chat With our Experts!

HTTP 401 UnauthorizedException

KenJ32
Campaign Collaborator
0 Votes

For several days my CC v3 API calls were working both in Postman and in my R Script.  Yesterday the calls started failing.  I am successfully retrieving the OAUTH token, but after passing it to the final GET call, I am getting the response below.  Any assistance would be appreciated.  

 

https://api.cc.email/v3/contacts?status=unsubscribed&include=custom_fields&limit=500&include_count=f...}

 

GET /v3/contacts
cache-control: no-cache
Postman-Token: #############
Authorization: Bearer {TOKEN}
User-Agent: PostmanRuntime/7.6.0
Accept: */*
Host: api.cc.email
accept-encoding: gzip, deflate
 
HTTP/1.1 401
status: 401
Content-Type: application/json
Content-Length: 59
Connection: keep-alive
Date: Tue, 22 Jan 2019 16:42:31 GMT
x-amzn-RequestId: b4cb3627-1e64-11e9-b9be-5558a99d58b5
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Content-Type,X-Amz-Date,Authorization,X-Api-Key
x-amzn-ErrorType: UnauthorizedException
x-amz-apigw-id: T6guSGURoAMFSgw=
Access-Control-Allow-Methods: GET,POST,PUT,DELETE,PATCH,OPTIONS
X-Cache: Error from cloudfront
Via: 1.1 c8b22b813bc9140f3fc38a5e2fae3685.cloudfront.net (CloudFront)
X-Amz-Cf-Id: cHKfG_lKisca1yQyh9cC8WfCxERTX1sE5CzwwRo-9J56jRDA__dCNw==
{"error_key":"unauthorized","error_message":"Unauthorized"}
9 REPLIES 9
RJF
Rookie
0 Votes

I'm getting the same thing.

 

Even when I go to the API Reference and connect via oAuth (https://v3.developer.constantcontact.com/api_reference/index.html#!/Contacts/getContacts)
I still get the same unauthorized 401

 

Anyone know what would cause this to happen?

AIMInstitute
Rookie
0 Votes

I'm also getting a 401 immediately after a successful token refresh.  I've been using the API with no issues for several months but all of a sudden, 401 errors.  This started yesterday at 12:09 PM.

 

I can refresh as many times as I want, but no matter what tokens I get back, I get a 401 response.

ScottR
Rookie
0 Votes

I was just about to create a post about this.

 

We have been using the v3 API since some weeks ago and all of sudden it stopped working.

 

We have investigating our code and came to the conclusion the issue is in the API side.

 

We can successfully make the authorization code request and receive the code.

 

Then we are able to exchange the code for an access token.

 

We are also able to use the refresh token in order to get a new access/refresh token.

 

The problem is that when we use the access_token to perform API requests, like:

 

curl -X GET \
'https://api.cc.email/v3/contacts?status=all&email=someperson%40domain.com&include_count=false&includ...' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer INSERT_SOME_VALID_RECENT_ACCESS_TOKEN_HERE' \
-H 'Cache-Control: no-cache' \
-H 'Accept: application/json'

 

We always get the response:

 

{"error_key":"unauthorized","error_message":"Unauthorized"}

Jimmy_D
Employee
0 Votes

Hello Everyone,

 

Sorry for the delayed response. As I'm sure you are already aware this issue has been resolved. We had a temporary issue with some certificates and they have been updated. Please let us know if you still see this problem.


Regards,
Jimmy D.
Tier II API Support Engineer
ArthurB21338
Rookie
0 Votes

I am currently experiencing this issue... 5/15/2019.

David_B.
Employee

Hello,

 

The issue in the original post was due to a temporary system issue. I'm not aware of a repeat of that issue. Are you still having this problem? During the previous issue we were able to replicate using our API Tester page at https://v3.developer.constantcontact.com/api_reference/index.html#!/Contacts/getContacts

 

If you are still having the issue, do you also see it using this API Reference tester?

 

Please have a look and let me know if you have any questions!

 

Regards,
David B.
Tier II API Support Engineer

DanielC171
Rookie
0 Votes

 

Hello,

 

I can confirm seeing the same error/issue.  We have OAuth Server Flow implemented - can receive code from our app, replace access and refresh tokens too.

 

When we make go to execute a curl request  in our code, we see this same error on screen.

 

Any suggestions would be helpful.

 

Thank you.

Jimmy_D
Employee
0 Votes

Hi @DanielC171 and @ArthurB21338,

 

If you are receiving this error still then it would be due to an issue with the call or the data being sent as we are not currently experiencing a system issue that would cause this.

 

I would verify that your code is correctly retrieving the Access Token and you can make a call with a new Access Token then attempt going through the refresh flow. If the error only occurs after going through the refresh flow verify that you are correctly replacing the old Access Token with the new Access Token.

 

If you are still having issues it would be beneficial to see a code snippet. Generally we recommend to email us at that point (webservices@constantcontact.com); however you are welcome to post the code here as well.


Regards,
Jimmy D.
Tier II API Support Engineer
FrankK144
Constant Contact Partner
0 Votes

I have been experiencing the same issue - exactly

 

It is not the request because after a series of attempts I get the proper response

This happens with every type of call (PUT, POST, GET, etc.)

 

Just a simple GET for my list of five campaigns will return this error every call for half an hour or more then the next attempt it returns the list properly.  It will then work for a while and then revert back to the HTTP 401 UnauthorizedException

This is all with the exact same code and call each time

Also, it will sometimes return an internal server error and do that for up to half an hour

Resources
Developer Portal

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

Visit Page

Announcements

API Updates

Join our list to be notified of new features and updates to our V3 API.

Sign Up