I am working with Laravel, and I am using PHP API SDK - https://github.com/constantcontact/php-sdk.
And also I see this - http://developer.constantcontact.com/docs/authentication/oauth-2.0-server-flow.html.
Now I am trying to get access_token.
I saw this - https://github.com/constantcontact/php-sdk/blob/master/examples/getAccessToken.php, I am working based on this.
From $oauth->getAuthorizationUrl(); , it is successfully redirected to redirect_uri page.
And also i see code in url parameters there.
But when it called getAccessToken(), it is failed with exception 'Unauthorized'
This is my code.
Solved! Go to Solution.
Nobody can help?
I get this code.
But I can't get access_token from it.
Maybe this code is invalid?
Thank you for reaching out to Constant Contact's API Support.
If you are receiving an unauthorized error then either your API Key is not correct, or the username/password you are logging in with are not authorized to do what you are requesting. Since you are just trying to get an Access Token I would first try to use our API Tester page and see if you can get an Access Token with the same credentials there. https://constantcontact.mashery.com/io-docs
If you are still having problems I would suggest you email us at email@example.com so we can troubleshoot further as we may need some information that is best to not post here.
@Jimmy_D, Thanks for your response.
I think it is related with redirect_uri.
I will see that.
I found the reason myself.
It is from redirect uri paramter.
I used correct redirect uri, but with some parameter.
In this time, it was not working.
I fixed it by removing parameter.
Glad to hear that you got that figured out. For anyone else who may come across this post just keep in mind that the redirect URI must match exactly. That includes parameters as well.