This has been asked relatively few times here, but the answers are just too vague for me, my appologies.
Can anyone explain to me, or point me to a detailed tutorial on how to set up the API to work with multiple domains? I understand that I need to set up a file on my server(which verifies with the CC API to get key, since only one URI is allowed) to allow my clients to connect to my CC API.
I have read a lot over the past two days and I have not come to any sort of conclusion. I have created a script within a popular CMS and ask them "Click here to connect" I want it to be as simple as possible, obviously the redirect uri has to be pointed back to their personal website so that it can store their code.
What sort of thing would I need on my end? I understand I need a redirect, but I just don't know how to begin sorting it all. There just isn't a whole lot of information other than a lot of diagrams and explanations on how to do it, but no solid code examples or anything.
Thanks very much for help.
Solved! Go to Solution.
Sent you a Private Message - may be easier to work through this together "offline" :)
Also just to update the forum - if anyone is looking to use dynamic API Callback URIs you can learn more about making an Authentification Request and then obtaining the Access Token via the API here:
Thank you for your awesome help Mike. I was able to connect and I am on my way to creating my add-on.
For anyone who is curious... you can add GET value onto your redirect URI that will pass when the application sends you back to your URI... so it can be like this in your application:
ofcourse that will be URL encoded... when it comes back to www.mywebsite.com/auth.php you an grab the variable in PHP and use it to create a header redirect back to the clientURL, along with all the other variables sent for use in the authentication process.
So if you need extra help with this like i did here was my solution:
My redirect URI had the URL of the client's site attached to it with a GET value attached on to the URI (note: not an extra value on the GET authenticate request it's self, it has to be a part of the URI only)
Send request directly to Constant Contact, user authorizes and redirects to my URI, along with the extra GET value and the auth codes n junk
My URI redirect is to a PHP file which takes the ClientURL and adds it to a 301 redirect header in the php file, redirecting the user back to their website along with all GET values without ever noticing.
After that you don't need your URI anymore, only for authentication.
Here's my server's redirect (it strips clientURL from the string so that the end url looks nice and clean)
$qStr = $_SERVER['QUERY_STRING'];
$url = $_GET['clientURL'] . '?' . http_build_query(array_diff_key($ar, array($key => '')));
header("Location: $url" );