0

Here is my code //var token1 = await _tokenStore.GetAccessTokenAsync(Id);

                //accessToken1 = token1.RefreshToken;
                //var restClient1 = new RestClient("https://identity.xero.com/connect/revocation");
                //var request1 = new RestRequest(Method.POST);
                //string encoded = base64encode(Configuration["Xero:ClientId"] + ":" + Configuration["Xero:ClientSecret"]);
                //request1.AddHeader("Authorization", string.Format("Basic {0}", encoded));
                //request1.AddHeader("Content-Type", "application/x-www-form-urlencoded");
                //request1.AddParameter("application/json", accessToken1, ParameterType.RequestBody);
                //var response1 = restClient1.Execute(request1);
test duck
  • 1
  • 1
  • Are you missing "token=" from the start of the request body? The doc suggests that you would send "token=xxxxxx", and I can't see that string in your code, though I am also not familiar with the language you are using. Failing that, what exactly happens? What return do you get in `response1`? – droopsnoot Feb 11 '21 at 09:43
  • I am getting invalid request error – test duck Feb 12 '21 at 07:27
  • do you have an example,How can I send it ,Please as I am passing acesstoken1 in body,Should it be like "accesstoken1={0}",Something like that ? – test duck Feb 12 '21 at 07:28
  • request1.AddParameter("application/json",token = accessToken1,ParameterType.RequestBody); request1.AddParameter(token= accessToken1, ParameterType.RequestBody); – test duck Feb 12 '21 at 08:00
  • I also tried by adding the token like this but still same error as"//inavlid request" – test duck Feb 12 '21 at 08:01
  • Assuming this is RestSharp, what about `request1.AddJsonBody(string.Format("token={0}", accessToken1));` - like I said, I don't know your language but what I could find of the doc suggests this would take the string `token=yourtoken`, convert it to JSON and send it as the post body. Or you could use AddXmlBody()`. – droopsnoot Feb 12 '21 at 10:16
  • I have a question tho,I am integrating xero in my c# application ,when i run the project and click on connect to xero it asks me credentials but when i disconnect it with using revocation api the api is working fine but when i click on login again it connects to xero without asking credentials – test duck Feb 12 '21 at 11:26
  • Sorry, I don't really know what you're asking there - I don't work my Xero integration the same way as mine is a machine to machine connection with no UI. You'd be better to post a new question so that people can see it without having to look down the comments. – droopsnoot Feb 12 '21 at 11:51
  • Okay no problem but thank you for the solution – test duck Feb 12 '21 at 11:54

0 Answers0