XeroAPI / Xero-NetStandard

A wrapper of the Xero API in the .NetStandard 2.0 framework. Supports Accounting, Payroll AU/US, and Files
MIT License
120 stars 119 forks source link

Getting Forbidden error when try to Request AccessToken from XeroClient #427

Open ShivDarshanSingh opened 2 years ago

ShivDarshanSingh commented 2 years ago

Hi I'm trying to login Xero for invoices

When I try to login in then callback url getting error like Forbidden I have tried to many things but nothing get good to login Please help

I have these In controller

image

error stacktrace at Xero.NetStandard.OAuth2.Client.XeroClient.RequestAccessTokenAsync(String code) at Project.Controllers.AuthorizationController.Callback(String code, String state) in C:BlazorDevelopementBlazor5_files_dev_child_2ControllersXeroAuthorizationController.cs:line 68

Message : Forbidden Source: Xero.NetStandard.OAuth2Client Method: Authorization/Callback

This is starting code to redirect var client = new XeroClient(XeroConfig.Value); var clientState = Guid.NewGuid().ToString(); TokenUtilities.StoreState(clientState);

return Redirect(client.BuildLoginUri(clientState));

using configuration file like this services.Configure(Configuration.GetSection("XeroConfiguration"));

This is my Xero configuration "XeroConfiguration": { "AppName": "Test App P3 server", "ClientId": "2**5", "ClientSecret": "ilm***WIy", "CallbackUri": "https://11*.1.2.2:70**/Authorization/Callback", "Scope": "openid profile email files accounting.transactions accounting.transactions.read accounting.reports.read accounting.journals.read accounting.settings accounting.settings.read accounting.contacts accounting.contacts.read accounting.attachments accounting.attachments.read offline_access payroll.employees payroll.payruns payroll.payslip payroll.settings payroll.timesheets assets", "State": "tester_state", "XeroAuthorizationAPI": "https://login.xero.com/identity/connect/authorize", "XeroAccessTokenAPI": "https://identity.xero.com/connect/token" }


Please let me know if anything wrong here and what I need to fix this error

Thanks

Sallyhornet commented 2 years ago

Please could you contact Xero's API Support team using this link https://developer.xero.com/contact-xero-developer-platform-support and include your client id and date and time of the last error (and the timezone)

ShivDarshanSingh commented 2 years ago

Please could you contact Xero's API Support team using this link https://developer.xero.com/contact-xero-developer-platform-support and include your client id and date and time of the last error (and the timezone)

Done, Can you please help if you know why I'm getting Forbidden error