User-2004102533 posted
I used the
TD Ameritrade POST site to successfully get an access token. When I later put the same values in C# I get an invalid_grant response. What can cause that?
Here is the C# code
string url = string.Format("https://api.tdameritrade.com/v1/oauth2/token");
RestClient client = new RestClient(url);
RestRequest postRequest = new RestRequest(Method.POST);
postRequest.AddHeader("cache-control", "no-cache");
postRequest.AddHeader("content-type", "application/x-www-form-urlencoded");
postRequest.AddParameter("application/x-www-form-urlencoded", "grant_type=authorization_code&access_type=offline&code= pMAPaM9nHYPUurvRxtnJXCINMAYP/1xDvZVEePiUFJYtsSldm88bVLxgf/f90XH653eEw8BbzE468HlZtgP4ph8igtGCFsTnyc/Z+N+CT/E=212FD3x19z9sWBHDJACbC00B75E&client_id=AMNEH3TUWFP@AMER.OAUTHAP&redirect_uri=http://localhost",
ParameterType.RequestBody);
IRestResponse response = client.Execute(postRequest);