Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Authentication >

unsupported_grant_type when refreshing token

Started by Tristan Colgate -   in API Authentication

I am getting an "unsupported_grant_type" error when trying to refresh my token.

Here's my C# code. I am quite new to C# so could be doing something silly:
btw - using RestSharp.

var client = new RestClient("https://identity.xero.com/connect/token");
client.Timeout = -1;
var request = new RestRequest(Method.POST);request.AddHeader("Authorization", "Basic " + Base64Encode(xconfig.ClientId + ":" + xconfig.ClientSecret));
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
request.AddXmlBody("grant_type= refresh_token");
request.AddXmlBody("refresh_token = "+refreshToken);
IRestResponse response = client.Execute(request);
Console.WriteLine("Refresh response: " + response.Content);
I'm facing the same issue, it is looking like refresh token is going to be expired or blacklisted after used a few times.

Mateus Petkovicz