How to create HTTP Post to swap auth code for access token?

Hi all, I’m pretty new to this but I have managed to connect to freeagent
and get my authorization code but I now need to swap that for an access
I am creating an MVC application so it will all be in c#, This is
what i have got so far:

public void AccessToken(string code)
string url = @“”;
WebClient client = new WebClient();
string credentials = Convert.ToBase64String(Encoding.ASCII.
GetBytes(ApiKey + “:” + ApiSecret));
client.Headers[HttpRequestHeader.Authorization] = "Basic " +credentials
client.Headers[HttpRequestHeader.Accept] = “application/json”;
client.Headers[HttpRequestHeader.ContentType] =
client.Headers[HttpRequestHeader.UserAgent] = “Java/1.6.0_33”;
client.Headers[HttpRequestHeader.Host] = “”;
client.Headers[HttpRequestHeader.Connection] = “close”;
client.Headers[“grant_type”] = “authorization_code”;

        var result = client.DownloadString(url);

I think the problem I am having is trying to add the grant_type. This is
what I was shown to add:


Can anyone offer any support with this, it is also possible that this is all wrong :slight_smile:

Thanks in advance