I'm trying to call the exact target auth api for the first time. I'm getting a 407 Proxy Authentication Required. Can you please let me know where I'm going wrong.

I'm using the following call

https://auth.exacttargetapis.com/v1/requestToken Content-Type: application/json{"ClientId":"myClientID","ClientSecret":"myClientSecret"}

With the above as requestUrl:

   HttpWebRequest request = WebRequest.Create(requestUrl) as HttpWebRequest;
            request.Method = "POST";
            request.Timeout = 1000;
            using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)

I've also tried the following:

with https://auth.exacttargetapis.com/v1/requestToken in url and "{\"ClientId\":\"myClientIDInHere\",\"ClientSecret\":\"MyclientSecretInHere\"}" in postdata.

It gets as far getRequestStream, but also get a 407 Proxy Authentication Exception public static string WebRequestinJson(string url, string postData) { string ret = string.Empty;

        StreamWriter requestWriter;

        var webRequest = System.Net.WebRequest.Create(url) as HttpWebRequest;
            if (webRequest != null)
                webRequest.Method = "POST";
                webRequest.ServicePoint.Expect100Continue = false;
                webRequest.Timeout = 20000;

                webRequest.ContentType = "application/json";
                //POST the data.
                using (requestWriter = new StreamWriter(webRequest.GetRequestStream()))

            HttpWebResponse resp = (HttpWebResponse) webRequest.GetResponse();
            Stream resStream = resp.GetResponseStream();
            StreamReader reader = new StreamReader(resStream);
            ret = reader.ReadToEnd();
        catch (Exception e)
            var msg = e.ToString(); 
        return ret;
  • What happens if you use something like POSTMAN to do the RESTcall with this clientID and clientSecret? Does that work fine? – Timothy Oct 14 '14 at 16:21
  • I used Postman, and when I put the clientId and ClientSecret in the form-data section it worked fine. The exact target documentation suggests POST auth.exacttargetapis.com/v1/requestToken Content-Type: application/json { "clientId": "YOUR_CLIENT_ID_FROM_APP_CENTER", "clientSecret": "YOUR_CLIENT_SECRET_FROM_APP_CENTER" } Is that the same thing as putting it in form-data? – Mike McKeown Oct 15 '14 at 14:32

I have created a Postman Collection which shows you how to use requestToken method correctly; download Collection here. Note that I'm using raw data in my POST request (but form-data also works) and the request includes a Content-Type header with value application/json.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.