Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Authentication >

Google Apps Script OAuth1.0a library returns xero_unknown_error in Public Application

Started by Jordan Rhea -   in API Authentication

I am building a public application and I am getting the error:

Error starting OAuth flow: oauth_problem=xero_unknown_error&oauth_problem_advice=could%20not%20generate%20a%20request%20token

I dove into the library itself to see where this error was being generated but it is only the request endpoint so I am sure I have some of the configuration wrong. Currently this is what I have:

OAuth1.createService('sheeo-reports')
.setOAuthVersion('1.0a')
.setAccessTokenUrl('https://api.xero.com/oauth/AccessToken')
.setRequestTokenUrl('https://api.xero.com/oauth/RequestToken')
.setAuthorizationUrl('https://api.xero.com/oauth/Authorize')
.setConsumerKey('PMK71XXXXXXXXXXXXXXXWMKA')
.setConsumerSecret('9KF1SFXXXXXXXXXXXXVK63SH0J')
.setCallbackFunction('authCallback')
.setPropertyStore(PropertiesService.getUserProperties()));

Can anyone help me identify what I am missing? When I compare to the documentation it seems like this is all I need, but that is obviously not the case. I am able to get the same consumerkey/secret working with Postman, but not through apps script.

Thanks for any help!