Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Authentication >

Private Application - The remote server returned an error: (400) Bad Request.

Started by Karthik ji -   in API Authentication

Hi there,
i did the following steps to get the consumer key and consumer Token for private application.

Generate a public/private key-pair for use with your application.
Login to the Xero Developer portal which is located at https://api.xero.com
Go to the My Applications > Add Application screen in the Xero Developer portal to add your application.
Select “Private” and enter a name for your application
Choose your organisation from the drop down list
Upload the public certificate (.cer file) you generated in step one.
Choose save. You will now have a Consumer Key to use for your application.

instead of access token i used the above consumer token and consumer secret.

OAuthHttpWebRequest httpRequest = new OAuthHttpWebRequest();
httpRequest.ConsumerToken = new OAuthToken { Token = "WICWMMIINQJL9RORP1KPC2YOUDMGA3", TokenSecret = "OJ2VIJ7STAKPYWZWDKS8P2MOML9KYG" };
httpRequest.Token = new OAuthToken() { Token ="WICWMMIINQJL9RORP1KPC2YOUDMGA3", TokenSecret = "OJ2VIJ7STAKPYWZWDKS8P2MOML9KYG" };
httpRequest.Method = "GET";

WebResponse uploadResponse;
uploadResponse = httpRequest.GetResponse();

after this code its throws "The remote server returned an error: (400) Bad Request." Here consumer key and secret used as access token and secret.