Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Endpoints >

Error code:500 Sorry,something went wrong

Started by shobha parameswaran -   in API Endpoints

Hi,
I am using your application XeroOauth2sample https://github.com/XeroAPI/xero-netstandard-oauth2-samples/tree/master/XeroOAuth2Sample to try and connect to a demo application using the api. But i keep getting the message "Sorry,something went wrong" Error code:500.
Please note my trial license has now expired . Is this the reason i am getting the error ?
Please advise.

Many Thanks
Hi Shobha,

Can you please provide me with your clientId and I'll take a look to see if there's any obvious issues on our side.

Cheers
Matt
 

Matthew Mortimer (Xero Staff)  

Hi,
The client id is
D904A6D8F491478B8067BEBDA815AC2E
thank you
shobha
 

shobha parameswaran  

I can see some errors for invalid redirect URIs. The sample will bootstrap specific redirect URIs that need to be set on your app. These are outlined in the samples readme.

You may have already solved this though, and if so I have a couple more questions.

Have you modified the sample in any way?
Do you have some reproduction steps for the error?
 

Matthew Mortimer (Xero Staff)  

I will redo the redirect URIs and give that a go.
Is there an option to authenticate without multi factor authentication ?
 

shobha parameswaran  

Was trying to get authentication via power bi custom connectors , since that failed tried the code route.
 

shobha parameswaran  

If your Xero user account has been set up for multi factor authentication, then no you'll need to use multi factor authentication when logging in
 

Matthew Mortimer (Xero Staff)  

Is there a way to disable MFA ?
 

shobha parameswaran  

You can find information on managing MFA in Xero Central: https://central.xero.com/s/article/Manage-two-step-authentication
 

Matthew Mortimer (Xero Staff)  

I do however suggest you read through this page before choosing to turn it off.

https://central.xero.com/s/article/Two-step-authentication-explained
 

Matthew Mortimer (Xero Staff)  

Hi,
Currently using XeroOauth2Sample solution to build an integration solution. The code below is used to create invoice but getting null reference errors .
Is this solution the best way to take or is there any other solution that i can use ?
What i am aiming is to automate the invoice creation process.

List<Xero.NetStandard.OAuth2.Model.LineItem> LItems = new List<Xero.NetStandard.OAuth2.Model.LineItem>();
LItems.Add(new Xero.NetStandard.OAuth2.Model.LineItem()
{
Description = "Testing desc1",
Quantity = 2,
UnitAmount = 3,
LineAmount = 10
});

Xero.NetStandard.OAuth2.Model.Invoices invs = new Xero.NetStandard.OAuth2.Model.Invoices();
Xero.NetStandard.OAuth2.Model.Invoice ij = new Xero.NetStandard.OAuth2.Model.Invoice();

ij.Contact = new Xero.NetStandard.OAuth2.Model.Contact();
ij.CurrencyCode = Xero.NetStandard.OAuth2.Model.CurrencyCode.AUD;
ij.Type = Xero.NetStandard.OAuth2.Model.Invoice.TypeEnum.ACCREC;
ij.Date = System.DateTime.Now;
ij.DueDate = System.DateTime.Now.AddDays(5);
ij.Status = Xero.NetStandard.OAuth2.Model.Invoice.StatusEnum.AUTHORISED;
ij.LineItems = LItems;

invs._Invoices.Add(ij);
var res = await _accountingApi.CreateInvoiceAsync(accessToken, tenantId, invs);
 

shobha parameswaran  

Do you have a stack trace for the null pointer exception we can inspect?
 

Matthew Mortimer (Xero Staff)  

Can i email you this ? Cos I keep getting "There was an error formatting your answer" .. Guess it's not my day .. getting error even on a post :)
 

shobha parameswaran  

Are you able to put it in a gist and link it here?
 

Matthew Mortimer (Xero Staff)  

Hi Matt,

Here it is https://gist.github.com/shobsp/3c6af1a8683f97cef735097fb0f19eb7
Thank you
 

shobha parameswaran  

Please ignore my previous request,this is now resolved . Just need to figure out what is the best method to integrate xero with other apps.
Thank you for all the help.
 

shobha parameswaran  

Hi, I'm getting the same error 500 message. I'm using xero-php-oauth2 SDK and my client ID is A43B220E950A44D0BA471A9AE4C0D848. Could you please help me? Thanks in advance.
 

Paco R  

Hi Paco,

I've taken a look through some logs, and I can see that you're making requests with an incorrect redirect uri. The one set up for your app is https, but your requests use a redirect uri using only http.
Have you resolved this particular error and up against some other errors or do you think this is the problem you're having right now?

Cheer,
Matt
 

Matthew Mortimer (Xero Staff)  

Hi Matthew,
I need to deploy the solution as an azure app service. For the authentication part , do i need to change anything other than the url in dev (http://localhost:500) to production ?
I am getting the same 500 error when i do that .
Many thanks
 

shobha parameswaran  

Hi Shobha,

I can't see any errors for the clientId you provided earlier.
Do you think the error might be on your side?

Cheers,
Matt
 

Matthew Mortimer (Xero Staff)  

Hi Matthew, thanks for your advice. I found it a few minutes after posting my message. Anyway, a more informative error message instead of the generic error 500, would have saved me hours of headache.
 

Paco R  

Hi Methew,
I am also getting the same error. "Sorry,something went wrong" Error code:500.
My Client ID is : 9AC62C13244743D98EB816E20913E55E
OAuth 2.0 redirect URI (Please write this url in your Xero app)
https://whatson.group/crm/admin/swift_xero/check_auth_xero

Will you please help me.

Thanks in advance,
Shahid
 

Shahidul Khan  

Hey Shahid,

You may want to check that you've set the correct redirectUris in your app. From our logs it looks like you've set https://whatson.group/crm/admin/settings?group=xero as your redirectUri which does not match what you've supplied in your question.

Cheers,
Matt
 

Matthew Mortimer (Xero Staff)