OAuth refresh token 401/404


I’m trying to use the FreeAgent API. I’m trying to refresh my Access Token, but I’m getting 401s and 404s depending on the different platform I test with.

As per the documentation I’m using the Client ID and Client Secret (also referred to as OAuth identifier, OAuth secret).

Here is a PHP code sample: http://pastebin.com/0qqqdZLv

I can’t get this to work in Postman Chrome plugin either.

I can’t see anything that I’m doing wrong, the documentation says to use a HTTP Basic Auth Post, that’s surely what I’m doing? And the credentials I’m taking from the “My Apps” Developer Dashboard, is that correct?

Can anyone let me know if I’m doing something wrong or if the credentials are somehow not working? Thanks.

Also, I have commented out line 22 and tried to manually add the Auth header at line 14, I was doing it with line 22 originally and getting the same result, I just wanted to make sure, which is why I tried line 14 instead.