Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Authentication >

Need Help for Java - Private Application Example Code

Started by WDCi Dev -   in API Authentication

Hi Guys,

I have followed the instruction from this link:
http://blog.xero.com/developer/getting-started/code/java-private-application-example/

I using the openssl-0.9.8g_win32 to generate the xero_privatekey.pcks8 and xero_publicket.cer

when I try to run the code from eclispe, I get this error:

Feb 18, 2013 3:38:00 PM org.apache.http.impl.client.DefaultRequestDirector handleResponse
WARNING: Authentication error: Unable to respond to any of these challenges: {oauth=WWW-Authenticate: OAuth Realm="202.168.70.82"}
Exception in thread "main" net.oauth.OAuthProblemException: signature_invalid
oauth_problem_advice: Failed to validate signature
URL: https://api.xero.com/api.xro/2.0/Invoices?oauth_token=CQCSGFZ2KEVLVRORZZLGFSRKG7GF0A&oauth_consumer_key=CQCSGFZ2KEVLVRORZZLGFSRKG7GF0A&oauth_signature_method=RSA-SHA1&oauth_timestamp=1361173078&oauth_nonce=24709272447583&oauth_version=1.0&oauth_signature=RDzYL8z7sxyTgMby%2FrN59VY9jSyIrG%2FTMahXmZF%2FdcheLLthlcPjJrklLS%2FGBGyKjjxW1FhDJUE%2BMpJ85RaW9P%2FagaIjmtREMgy3nOelvxAH1dd5mK2b6u1W%2BHrjc9CrhOUFQi9xQOvHI74pbMg69vNTVI8XxdziQUTchLDj4Bg%3D
oauth_signature base string: GET&https%3A%2F%2Fapi.xero.com%2Fapi.xro%2F2.0%2FInvoices&oauth_consumer_key%3DCQCSGFZ2KEVLVRORZZLGFSRKG7GF0A%26oauth_nonce%3D24709272447583%26oauth_signature_method%3DRSA-SHA1%26oauth_timestamp%3D1361173078%26oauth_token%3DCQCSGFZ2KEVLVRORZZLGFSRKG7GF0A%26oauth_version%3D1.0
>>>>>>>> HTTP request:
GET /api.xro/2.0/Invoices?oauth_token=CQCSGFZ2KEVLVRORZZLGFSRKG7GF0A&oauth_consumer_key=CQCSGFZ2KEVLVRORZZLGFSRKG7GF0A&oauth_signature_method=RSA-SHA1&oauth_timestamp=1361173078&oauth_nonce=24709272447583&oauth_version=1.0&oauth_signature=RDzYL8z7sxyTgMby/rN59VY9jSyIrG/TMahXmZF/dcheLLthlcPjJrklLS/GBGyKjjxW1FhDJUE+MpJ85RaW9P/agaIjmtREMgy3nOelvxAH1dd5mK2b6u1W+Hrjc9CrhOUFQi9xQOvHI74pbMg69vNTVI8XxdziQUTchLDj4Bg=


<<<<<<<< HTTP response:
HTTP/1.1 401 Unauthorized
Cache-Control: private
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNetMvc-Version: 2.0
WWW-Authenticate: OAuth Realm="202.168.70.82"
X-AspNet-Version: 4.0.30319
X-Powered-By: TeamXero
X-S: 445760-O1VMAP03
Date: Mon, 18 Feb 2013 07:38:01 GMT
Content-Length: 87

oauth_problem=signature_invalid&oauth_problem_advice=Failed%20to%20validate%20signat

Did anyone has any idea on this issue?
Hi, the problem is resolved. I was my mistake. Because I did not upload the latest certificate into my Applications
 

WDCi Dev  

Hi i have tried the sample code given for private application.
But iam getting the following error

ERROR:

10 Dec, 2013 7:08:17 PM org.apache.http.impl.client.DefaultRequestDirector handleResponse
WARNING: Authentication error: Unable to respond to any of these challenges: {oauth=WWW-Authenticate: OAuth Realm="103.5.78.10"}
net.oauth.OAuthProblemException: signature_invalid
at net.oauth.client.OAuthResponseMessage.toOAuthProblemException(OAuthResponseMessage.java:83)
at net.oauth.client.OAuthClient.invoke(OAuthClient.java:331)
at net.oauth.client.OAuthClient.invoke(OAuthClient.java:284)
at net.oauth.client.OAuthClient.invoke(OAuthClient.java:314)
at PrivateApp.main(PrivateApp.java:56)
Exception in thread "main" java.lang.NullPointerException
at PrivateApp.main(PrivateApp.java:78)




could anyone tell me what went wrong here and also the possible causes for giving this
kind of error.
 

Aravind Venkatesh