Got a 'How do I' question? Join 'Ask a Trainer' Monday to Friday, 11am to 4pm ET for instant help and pro tips!

Refresh token strangeness

SOLVED
Go to solution
FirstNameL86527
Campaign Expert
0 Votes

I am using server flow to authenticate a batch process.  I successfully exchange the authorization code for an Access Token and Refresh token (step 4) of the documented process.

 

Next, I have a loop (as I am still in an early debug stage) where I refresh my token 5 times - just to see if it works.  The first 4 responses include 'access_token', 'refresh_token', and 'token_type'.  The 5th call, however, only returns an 'access_token' and a 'token_type'.

 

Why am I getting this strange (to me, at least) response?  I'd expect it to look like the previous 4 - which included a 'refresh_token'.

1 ACCEPTED SOLUTION
Jimmy_D
Employee
0 Votes

Hello @FirstNameL86527,

 

Thank you for reaching out to Constant Contact's API Support.

 

I would expect all of the responses to have the same format, of course with different values for the tokens. The only thing I could see that might be an issue is if you hit a rate limit which would give you a different error.

 

How quickly did you make your five requests and have you tried again and gotten the same, or a different response?


Regards,
Jimmy D.
Tier II API Support Engineer

View solution in original post

2 REPLIES 2
Jimmy_D
Employee
0 Votes

Hello @FirstNameL86527,

 

Thank you for reaching out to Constant Contact's API Support.

 

I would expect all of the responses to have the same format, of course with different values for the tokens. The only thing I could see that might be an issue is if you hit a rate limit which would give you a different error.

 

How quickly did you make your five requests and have you tried again and gotten the same, or a different response?


Regards,
Jimmy D.
Tier II API Support Engineer
FirstNameL86527
Campaign Expert
0 Votes

It appears the problem is due to the rapidity of calls to get the refresh token.  I have a loop of calls to refresh the token 25 times.  When called I get several successful refreshes, then, I get just an access_token and token_type.  But, if I add a 5 second delay between calls, all 25 work fine.

 

Given that 25 immediate consecutive calls isn't really a valid use case, this doesn't appear to be a problem.  I originally was just experimenting with the API call to get a refresh token when this problem occurred.

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