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'.
Solved! Go to Solution.
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?
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.