Calling All Developers
Connect with fellow code ninjas in the Constant Contact Community.
Regular Visitor
Posts: 1
Registered: ‎05-02-2012

Problems using OAuth 2.0 (java developer)

Hi I just started using the CTCT API, my idea is to use the OAuth 2.0 mechanism, (I am a java developer) the issue that I have is that I could not find a java code example that shows me how to do it properly. What I found is an open source library called "scribe" (version 1.3) I have read it, this version has a Constant contact support, but it does not seem to support OAuth 2.0.
I am a little bit lost with all of this, if anyone can help me by giving me an example, or some kind of guidance, I would appreciate very much.

Thank you.
Best regards.
Agustin Leira.

Posts: 1,743
Topics: 8
Kudos: 86
Solutions: 64
Registered: ‎06-19-2008

Re: Problems using OAuth 2.0 (java developer)

The Scribe library implements Constant Contact OAuth 1.0a, which is an older version of OAuth and a far more complicated one.  I would not recommend using that solution, we are moving towards only supporting OAuth 2.0 going forward as it is a much easier to use and implement solution.


OAuth 2.0 is actually so easy to implement that I haven't run into any libraries for doing the client side flow.  While I haven't implemented OAuth 2.0 in Java, I have done it in PHP and C# .NET, both of which took less than 10-15m to build the pages.  You'll basically just need to do these steps, which are detailed in our documentation for what data is required and returned in each one. 


  1.  Create a button/link for connecting to Constant Contact - this link should point to our OAuth page and contain all required parameters
  2.  Receive our reply to your redirect url, which must match exactly the redirect URL you currently have on file with your API key. 
  3.  Exchange the authorization token for the access token, store the access token and username for future use.  This data is returned via JSON as part of our response

That's all you'll need to do to get OAuth 2.0 implemented.  Let me know if you have any questions.

Dave Berard
Senior Product Manager, Constant Contact