05-07-2012 01:27 PM
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.
05-07-2012 04:52 PM
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.
- Create a button/link for connecting to Constant Contact - this link should point to our OAuth page and contain all required parameters
- Receive our reply to your redirect url, which must match exactly the redirect URL you currently have on file with your API key.
- 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.
Senior Product Manager, Constant Contact