XeroAPI / xero-php-oauth2

Xero PHP SDK for oAuth 2 generated from Xero API OpenAPI Spec 3.0
MIT License
92 stars 66 forks source link

PayrollAUAPI getPayItem #252

Closed lawipac closed 3 years ago

lawipac commented 3 years ago

SDK you're using (please complete the following information):

Describe the bug using PayRollAPi trying to get payItems, got 403, and XERO supports replies:

Based on the log that I located using Xero-Correlation-id: 1e31f621-5939-4ecb-b4c8-436b23a06c4c, the 403 response was thrown because the Tenant ID being used in the headers is missing.

One thing worth mention is that Accounting API works fine.

To Reproduce Steps to reproduce the behavior:

  1. finish Xero authorization process
  2. Trying to get a list of PayItems

using similar code from https://xeroapi.github.io/xero-php-oauth2/docs/v2/payroll_au/index.html#api-PayrollAu-getPayItems

Expected behavior a list of items being retrieved.

Screenshots 403 error occurred

Additional context The same set of Token works fine with Accounting API, We have added all possible scopes for OAUTH2, and disconnect, reconnect to XERO many times, to no avail.

public $options = [ 'scope' => ['openid email profile offline_access assets projects accounting.settings accounting.transactions accounting.contacts accounting.journals.read accounting.reports.read accounting.attachments payroll.employees payroll.payruns payroll.payslip payroll.timesheets payroll.settings files']};

Snag_4fc2319

lawipac commented 3 years ago

It must have been some other mistakes that I made, I tried a clean install with the sample app, it works fine.

lawipac commented 3 years ago

I just realized that the sample app is using xero-php-oauth2 version 2.5.4. while my code is using the latest 2.8.1.

I changed nothing with my code, and it all works fine now. I'll try to repeat this process to see if it is a real bug.