I have had this integration working for quite some time. I haven’t had to re-establish oauth and I am trying to remember my steps. I have a way to login to keap using my web app and get the redirect_uri back to retrieve the code. So I know my redirect_uri is good. I also have a way to keep my token refreshed, but something happened to my cron job and it all expired. I am pretty sure I used Postman to request the access token again, but now in my Postman Post I am getting an error back that says Invalid redirect_uri. I am sending back the exact same redirect_uri that I sent on the oauth request and not sure why I am now getting this error. I am using the content_type = application/x-www-form-urlencoded header and in the body I am using x-www-form-urlencoded. Any suggestions?
Welcome @Brad_Moore, sounds to me you may have something not formatted properly with your URI.
This is what I have got in my PHP code to create the Authorization URI Link.
return 'https://accounts.infusionsoft.com/app/oauth/authorize?' .
http_build_query(
[
'client_id' => $this->client->get_client_id(),
'response_type' => 'code',
'scope' => 'full',
'redirect_uri' => $this->client->get_redirect_uri()
]);
The “http_build_query” PHP function will encode the URI Parameters.
I basically click on the Link which will connect to Keap to authorize the connection against the particular Account selected. Then the Authorization Code is return to the Redirect URI Link.
Double check if you are encoding the Redirect URI correctly.
Thank you. I am using JavaScript and will try encodeURI. I did another quick test with encodeURIComponent and infusionsoft threw and error that said invalid uri. I will try again.
Brad Moore | Head of Technology and Head of Marketing
Dyslexia Help LLC
(816) 522-8158
www.dyslexia101.com
@Brad_Moore, where exactly is the Redirect URI in your query?
What I have learnt it is better to put it at the end so that you use additional parameters for it safely.
Is your URI something different than normal?
I presume the Client ID is correct, etc?