Hello user959297,
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.
At this time, we are not offering any Basic Authentication solutions, as we are currently in the process of deprecating our V1 API. Our newest version, the V3 API, uses OAuth2.0 to authenticate and connect accounts to your integration.
Getting Started with V3 API https://v3.developer.constantcontact.com/api_guide/index.html
While the V3 API requires a few more steps to be programmed into your application for authentication, when end users go to connect the integration to their Constant Contact account, all they will need to do is: grant permission for the integration to access their account (and either be logged in, or log in at that time).
Please note that the V3 API OAuth2.0 Server Flow will return a unique authorization code and token set for each account that connects to your integration/key, so your application should store these token sets separately in a way that it can identify requests sent/received for each connected Constant Contact account based on the access token used when calling the API.
Authorization Request URL https://v3.developer.constantcontact.com/api_guide/server_flow.html#step-2-add-the-authorization-request-url-to-your-application
Within your application, if you currently have an area where the user would have previously input their Constant Contact credentials (username/password), you’ll want to replace that with a “Connect Account” (or whichever preferred verbiage) button that redirects to the Authorization Request URL (step 1 of the V3 API OAuth2.0 Server Flow as detailed below).
You’ll want to start by going through the V3 API OAuth Server Flow. Please note, after step 1, you should set up step 4 before proceeding, because the authorization code from steps 2 and 3 only has a lifespan of 60 seconds.
V3 API OAuth2.0 Server Flow https://v3.developer.constantcontact.com/api_guide/server_flow.html
Tokens Overview https://developer.constantcontact.com/api_guide/auth_overview.html#tokens
In step one of the V3 API OAuth2.0 Server Flow, you’ll want to set up your “redirect_uri” so that after a client grants permission via the Authorization Request URL, Authorization Service can send the user to a webpage that you specify, and also send the Authorization Code back to your application so that it can complete the Authentication process.
Create an Authorization Request URL https://v3.developer.constantcontact.com/api_guide/server_flow.html#step-1-create-an-authorization-request-url
Authentication Overview https://v3.developer.constantcontact.com/api_guide/auth_overview.html
Get the Token from the Redirect URL https://v3.developer.constantcontact.com/api_guide/auth_overview.html#get-the-token-from-the-redirect-url
Once you have your first set of tokens, you’ll want to set the access token and the refresh token as values for corresponding variables (for each connected account) 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 those variables to maintain an authenticated connection.
You can either have the application refresh each account’s 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. If choosing the second (less recommended) option, it would be beneficial to make sure that the calls are synchronous.
V3 API - Refresh the Access Token https://v3.developer.constantcontact.com/api_guide/server_flow.html#step-5-refresh-the-access-token
How to Make Access Tokens Last Longer https://developer.constantcontact.com/api_guide/faqs_manage_applications.html
Please have a look and let us know if you have any other questions!
... View more