My goal is to automatically add a contact to constant contact once a user signs up for an account.
With that being said I have seen a couple of examples on support about the C# V3 API. They all start with something along the lines of an authorization code.
Which is the one part I am struggling to get. I've created an application and authorized it but I am not sure where that information comes from.
How long is the authorization code valid? Do I need to implement some sort of refresh logic?
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 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
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 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 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.
V3 API - Refresh the Access Token
How to Make Access Tokens Last Longer