Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Authentication >

C# API wrapper running on Mono - Consumer key was not recognised

Started by Royd Brayshay -   in API Authentication

I've got your C# API wrapper code running fine on Windows, what I really want is to get it to work under Mono on a Linux box. I've moved the code over and made everything compile with no code changes but now I have a problem running the example.
I'm running the console app. sample in "Public App" mode, the first part - getting expense account and nominal journals works fine, then there is a problem...
After inputting the new account string the app fails when making the put request with "Consumer key was not recognised". I've spent some time checking the request with that sent on my Windows box and they look to be the same but I guess it cant be. Do you have any idea what going on at your end? (I'm using an organisation called Testorg).

Thanks in advance,
Hi Royd,

The "Consumer key was not recognised" message is only returned with the oauth_consumer_key oauth parameter does not match an active application registered with the Xero API.

It might be worth recording the http traffic from the console app using an http proxy. Fiddler2 works great on Windows machines, but I'm not sure what's suitable on Linux. If you can see the http calls being made, you can check that the correct oauth_consumer_key parameter is being set correctly.

UPDATE: I've also just tried the XeroApi.ConsoleTests.exe application on linux/mono and have got to exactly the same "Consumer key was not recognised" error. I managed to debug into the ConsumerRequest object that was making the http call and this did have the correct oauth_consumer_key parameter. Something fishy is happening in the mono runtime, but I've not found the root cause.


Daniel Barratt (Xero Staff)  

Hi Dan,
Yes, I came to the same conclusion - that the mono runtime is different to Windows somehow. I installed Wireshark intending to sniff the outgoing request but because the transport is https (and I'm not a Wireshark sniffing expert) its not that straight forward. I was hopping you may be able to throw some light on things more efficiently by debugging locally or running over http.
Thanks again for getting back to me, I really appreciate any help you can give here.

Royd Brayshay