502 Bad Gateway For Access token request

I am writing an online app to allow our clients to see a summary of there
invoices and unfortunately I’m falling at the first hurdle.
The Authorization request has worke and hit my local callback page but when
I proceed to issue an http request to retrieve the access token and the
refresh token I get a 502 Bad Gateway response and a page displaying a
“We’re having to perform some unexpected maintenance.”.
I am using CFML to initiate the http request with the following code:

The header returned is

HTTP/1.1 502 Bad Gateway Content-Type: text/html; charset=utf-8 Set-Cookie:
uid=1YFNslYWg6qAK2UmH2JUAg==; expires=Fri, 07-Oct-16 14:54:34 GMT;
domain=.freeagent.com; path=/ Connection: close Date: Thu, 08 Oct 2015
14:54:34 GMT ETag: “51387c83-16d6” Content-Length: 5846 Server: nginx

And the body is


xmlns=“http://www.w3.org/1999/xhtml” lang=“en” xml:lang=“en”>

We're having to perform some unexpected maintenance.

We'll be back soon!

We're experiencing unexpected downtime. We should be back online shortly.

Thank you for your patience.

It’s always possible that there is some maintenance going on but I suspect
it’s more likely that I’m getting something wrong here.

Any help is much appreciated.