package org.scribe.builder.api;

import org.scribe.model.OAuthConfig;
import org.scribe.utils.OAuthEncoder;

public class ConstantContactApi2 extends DefaultApi20 
{
	
	private static final String AUTHORIZE_URL = "https://oauth2.constantcontact.com/oauth2/oauth/siteowner/authorize?client_id=%s&response_type=code&redirect_uri=%s";
	
	@Override
	public String getAccessTokenEndpoint() 
	{
		return "https://oauth2.constantcontact.com/oauth2/oauth/token";
	}

	@Override
	public String getAuthorizationUrl(OAuthConfig config) 
	{
		return String.format(AUTHORIZE_URL, config.getApiKey(), OAuthEncoder.encode(config.getCallback()));
	}
}

@@ -39,75 +39,344 @@
 ort 
-org.scribe.model.OAuthConfig;%0D%0Aimport org.scribe.utils.OAuthEncoder
+java.util.regex.Matcher;%0D%0Aimport java.util.regex.Pattern;%0D%0A%0D%0Aimport org.scribe.exceptions.OAuthException;%0D%0Aimport org.scribe.extractors.AccessTokenExtractor;%0D%0Aimport org.scribe.model.OAuthConfig;%0D%0Aimport org.scribe.model.Token;%0D%0Aimport org.scribe.model.Verb;%0D%0Aimport org.scribe.utils.OAuthEncoder;%0D%0Aimport org.scribe.utils.Preconditions
 ;%0D%0A%0D
@@ -727,16 +727,46 @@
 th/token
+?grant_type=authorization_code
 %22;%0D%0A%09%7D%0D%0A
@@ -767,16 +767,19 @@
 %0D%0A%09%7D%0D%0A%0D%0A
+%09%0D%0A
 %09@Overri
@@ -950,11 +950,1027 @@
 );%0D%0A%09%7D%0D%0A
-%7D%0D%0A
+%09%0D%0A    @Override%0D%0A    public Verb getAccessTokenVerb() %7B%0D%0A        return Verb.POST;%0D%0A    %7D%0D%0A    %0D%0A    @Override%0D%0A    public AccessTokenExtractor getAccessTokenExtractor() %7B%0D%0A        return new AccessTokenExtractor() %7B%0D%0A            %0D%0A            @Override%0D%0A            public Token extract(String response) %7B%0D%0A                Preconditions.checkEmptyString(response, %22Response body is incorrect. Can't extract a token from an empty string%22);%0D%0A%0D%0A                String regex = %22%5C%22access_token%5C%22%5C%5Cs*:%5C%5Cs*%5C%22(%5B%5E&%5C%22%5D+)%5C%22%22;%0D%0A%09%09%09%09Matcher matcher = Pattern.compile(regex).matcher(response);%0D%0A                if (matcher.find())%0D%0A                %7B%0D%0A                  String token = OAuthEncoder.decode(matcher.group(1));%0D%0A                  return new Token(token, %22%22, response);%0D%0A                %7D %0D%0A                else%0D%0A                %7B%0D%0A                  throw new OAuthException(%22Response body is incorrect. Can't extract a token from this: '%22 + response + %22'%22, null);%0D%0A                %7D%0D%0A            %7D%0D%0A        %7D;%0D%0A    %7D%0D%0A%7D

Update src/main/java/org/scribe/builder/api/ConstantContactApi2.java