Join our Ask A Trainer Sessions and Chat With our Great Trainers!

Difficulty generating OAUTH 2.0 token

GinaO11771
Rookie
0 Votes

Hello everyone,

 

I am VERY new to generating an OAUTH 2.0 token for use with accessing Constant Contact via ColdFusion 8.0, and am having one heck of a time.

 

Any guidance on how to generate a token? I have spent several hours going over the documentation and trying multiple options with no success. If I use CFHTTP, that fails. If I put the URL into the address bar of my browser, I get a login request, then upon entering my credentials, I get a JBOSS 404 error. I have confirmed that the redirect_uri is the same as the one I identified for use with my API key.

 

Thanks in advance for any tips you may have.

6 REPLIES 6
Mark-C
Marketing Legend
0 Votes

Hello,

 

Does the  404 error happen just after entering your account credentials, or aftter you click "Allow Access?"  I can't say for sure without knowing more, but it sounds as though after you enter account credentials and click to authorize, you may be getting redirected properly to your redirect uri, but the call being made to request exchange the authorization code that is returned as a GET parameters with that redirect is being made to an invalid url.  

 

The flow should be:

 

1) You app redirects to our authorization url, where you login and click "allow access"

2) Our server redirects browser back to your redirect uri with GET parameters, including authorization code

3) Your app redirects back to our token url, passing the authorization code back (among other parameters)

4) Our server validates the request, generates the token, and POSTs back to your redirect uri.

 

So, it sounds like step 3 is where you're probably getting the JBOSS 404, and that probably indicates this redirect isn't correct.

 

It should be to: https://oauth2.constantcontact.com/oauth2/oauth/token? with parameters appended. Let me know if this helps.

Mark Coleman
Support Engineer
GinaO11771
Rookie
0 Votes

Thank you Mark. I will give this a try when I get into the office tomorrow and let you know.

mitschj
Rookie
0 Votes

I am not sure how this came out last April, but as I am trying to build an OAUTH2 authentication to replace a basic authentication, I don't seem to get past the first request to authorize:

 

https://oauth2.constantcontact.com/oauth2/oauth/{0}/authorize?response_type=code&client_id={1}&redir...

 

after substituting the appropriate client values, I get redirected to a login page, enter name and password and then get a 404.  There is no ability to Approve the Access.  The redirect_uri is in fact identical to the page I am calling, and also identical to the registered request_uri in the API_KEY.  I don't see another reason mentioned for this 404.

 

The next place to look would be...

 

Nick_G
Employee
0 Votes

Hey pecotj,

 

It looks like you are replacing the word "siteowner" in the URL with a variable. That's part of the URL, not a dynamic value, so that would explain a 404 once you've authenticated. If you are still having issues after replacing that portion of the URL, we'd need some sensitive account information to troubleshoot, so please PM me or send an email to webservices@constantcontact.com.

Nick Galbraith
Support Engineer
mitschj
Rookie
0 Votes

That makes the difference.  I don't know why I leapt to the conclusion that the string "siteowner" was a placeholder for the account name.  

 

Thanks Much!

AlexM760
Campaign Contributor
0 Votes

I know this is a super old issue but I was running into the same problem. The v3 URL is different and is below:

 

 
Take note to the URL above not ending in a forward slash. My issue was that I was using a forward slash:
 
 
The above URL was giving me a 404 error because of the forward slash. Be wary!
Resources
Developer Portal

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

Visit Page

Announcements

API Updates

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

Sign Up