Thank you for reaching out to Constant Contact API Developer Support. My team is here to assist outside software developers with questions about building into Constant Contact's API.
In our V3 API, CORS is supported and the response should include an Access-Control-Allow-Origin header.
However, based on the logs for the API key that has recently connected with the account that you are posting from, I was seeing quite a few responses with the following error: "invalid_grant: unknown, invalid, or expired refresh token"
While the V3 API’s access tokens automatically expire two hours after their last use and have a maximum lifetime of 24 hours, refresh tokens will not expire unless they have been used and/or a new token set has been generated. However, refresh tokens can only be used once, as generating a new set of tokens causes all previous tokens (access and refresh) to expire.
Once you have your first set of tokens, you’ll want to set both the access token and the refresh token as values for corresponding variables in your application, so that when your program runs through step 5 of the OAuth2.0 Server Flow to get the new set of tokens it can assign new values to both of those variables to maintain an authenticated connection.
V3 API - Refresh the Access Token
You can either have the application refresh the tokens on a timer based on the life of the access token, or you can have each submission check to see if the access token is still active, and then use the refresh token to generate a new set of tokens if not.
How to Make Access Tokens Last Longer
If you feel that my reply was not a good fit for your inquiry, please feel free to email our team directly at email@example.com and provide us with the API key you are using, the username for the Constant Contact account you are connecting with, as well as the full request, most recent refresh token value, and the full error response that you are receiving so that we can look into the issue with you further.
Please have a look and let us know if you have any other questions!
... View more