Xero-NetStandard icon indicating copy to clipboard operation
Xero-NetStandard copied to clipboard

Getting Forbidden error when try to Request AccessToken from XeroClient

Open ShivDarshanSingh opened this issue 3 years ago • 2 comments

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<XeroConfiguration>(Configuration.GetSection("XeroConfiguration"));

This is my Xero configuration "XeroConfiguration": { "AppName": "Test App P3 server", "ClientId": "25", "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

ShivDarshanSingh avatar Jul 07 '22 09:07 ShivDarshanSingh

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)

Sallyhornet avatar Jul 07 '22 09:07 Sallyhornet

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

ShivDarshanSingh avatar Jul 07 '22 09:07 ShivDarshanSingh