How to generate authorization code by a program

0 Votes


I have successfully generated the authorization url.

Using this I have to generate the authorization code programatically in PHP.
By simply the authorization url I will get the code fromhttp://localhost:8888/?code=lN1LhAHGX6oOSIKuty0RzWJnv5120O
as suggested  in the documentation. But I have to generate the authorization code programatically. Is there any solution?
0 Votes

Hello user6241929,


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.


You will want to use the Redirect URL to send the authorization code from the Authorization Request URL back to your Application in order to exchange it for your initial token set.


Example Authorization Request URL


Get the Token from the Redirect URL


There is no way to bypass the Authorization Request screen (which is only accessible via browser), but you should only need to authorize an account once. Once you go through the V3 API OAuth2.0 Server Flow in order to get an access token and refresh token for your key, you can use access tokens to make requests using the V3 API, and refresh tokens to obtain new access tokens without any user input. This ensures that your users only need to authenticate once.


Please have a look and let us know if you have any other questions!


Courtney E.
Tier II API Support Engineer

Did I answer your question?
If so, please mark my post as an "Accepted Solution" by clicking the Accept as Solution button in the bottom right hand corner of this post.
Developer Portal

View API documentation, code samples, get your API key.

Visit Page


API Updates

Join our list to be notified of new features and updates to our V3 API.

Sign Up

How confident are you about the effectiveness of your current marketing strategy?

Top Choice: Not confident at all (64%)