I've read through the docs, but I am still confused as to how I get an access token in v3 to use on a simple PHP web form (newsletter signup). When I read the info, it sounds like a token is temporary, but I need this to be hard coded on my website. Also, the listed process is confusing.
I just want to add a new contact to a Constant Contact list when a user checks the newsletter signup checkbox on my website quote/contact forms.
I see the API Key. After that it starts to make less sense to me (Redirect URI, OAuth2). Any help would be greatly appreciated.
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.
To get started with the V3 API, you’ll want to start by going through the V3 API Authorization Code 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 300 seconds. The Authorization Code Flow’s documentation also has PHP examples for the Authorization, Access & Refresh token requests .
In step one of the V3 API OAuth2.0 Authorization Code 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.
V3 API OAuth2.0 Authorization Code Flow
V3 API OAuth2.0 Overview
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 in your application, so that when your program runs through step 8 of the OAuth2.0 Authorization Code Flow to get the new set of tokens it can assign new values to those variables to maintain an authenticated connection.
V3 API - Refresh the Access Token
I’m also including documentation on our sign-up form endpoint that you can use to add or update contacts through the form you are developing.
V3 API Sign-up Form Endpoint:
Please have a look and let us know if you have any other questions!
View API documentation, code samples, get your API key.Visit Page
Join our list to be notified of new features and updates to our V3 API.Sign Up