Unable to get access token


Unable to get access token

I believe I've followed the docs, but am getting a 400 status code when trying to get an access token.  I've created the API code and call the following URL to get the auth code:   

// https://api.cc.email/v3/idfed?client_id=22c<redacted>2c3b&redirect_uri=https%3A%2F%2Flocalhost&response_type=code&scope=account_read+account_update+contact_data

private HashMap< String , String > headersMap = new HashMap<>();


ConstantContactUtilities constantContactUtilities = new ConstantContactUtilities();


public ConstantContactUtilities() {

// apiKey and clientId are the same field. Stupid ConstantContact uses both terms for the same thing
String apiKey = "22c<redacted>2c3b";
String clientSecret = "RPd<redacted>jCQ";

String credentials = apiKey + ":" + clientSecret;
String authorization = "Basic " + Base64.getEncoder().encodeToString(credentials.getBytes());

headersMap.put( "Authorization" , authorization );

public void getAuthCodeFromAccessTokenAndRefreshToken() throws IOException {

String authCode = "Bo090<redacted>8NQAEt";

HttpUtilities httpUtilities = HttpUtilities.getInstance();
String url = "https://idfed.constantcontact.com/as/token.oauth2?code=" + authCode +
HttpResponse httpResponse = httpUtilities.doPost( url , headersMap , new HashMap< String , String >() );
System.out.println( httpResponse.getStatusLine() ); <-- 400 status code

What am I doing wrong?



Hello Todd,


It looks like we already reached out to you via email regarding this issue to request some additional information in order to assist in troubleshooting. If you still need assistance with this, please let us know!


Courtney E.
API Support Specialist

Did I answer your question?
Developer Portal

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

Visit Page