Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error fetching contact by contact ID #805

Open
abhimanusharma opened this issue May 5, 2021 · 8 comments
Open

Error fetching contact by contact ID #805

abhimanusharma opened this issue May 5, 2021 · 8 comments

Comments

@abhimanusharma
Copy link

I am also facing error while getting a single contact.

I have scopes accounting.transactions accounting.contacts added in my request.

My $xero is returning the xero object successfully.
but code
$contact = $xero->loadByGUID(Contact::class, $guid);

is returning error.

XeroPHP\Remote\Exception\ForbiddenException: You are not permitted to access this resource in /var/www/html/project_dev/vendor/calcinai/xero-php/src/XeroPHP/Remote/Response.php:127
Stack trace:
#0 /var/www/html/project_dev/vendor/calcinai/xero-php/src/XeroPHP/Remote/Request.php(119): XeroPHP\Remote\Response->parse()
#1 /var/www/html/project_dev/vendor/calcinai/xero-php/src/XeroPHP/Application.php(200): XeroPHP\Remote\Request->send()
#2 /var/www/html/project_dev/vendor/langleyfoxall/xero-laravel/src/Wrappers/QueryWrapper.php(102): XeroPHP\Application->loadByGUID('\\XeroPHP\\Models...', 'xxxxxxxx-xxxx-x...')
@calcinai
Copy link
Owner

calcinai commented May 5, 2021

Are you attempting to load a contact with the GUID xxxxxxxx-xxxx-x...?

@abhimanusharma
Copy link
Author

Are you attempting to load a contact with the GUID xxxxxxxx-xxxx-x...?

I had masked the ContactID

XeroPHP\Remote\Exception\ForbiddenException: You are not permitted to access this resource in /var/www/html/project_dev/vendor/calcinai/xero-php/src/XeroPHP/Remote/Response.php:127
Stack trace:
#0 /var/www/html/project_dev/vendor/calcinai/xero-php/src/XeroPHP/Remote/Request.php(119): XeroPHP\Remote\Response->parse()
#1 /var/www/html/project_dev/vendor/calcinai/xero-php/src/XeroPHP/Application.php(200): XeroPHP\Remote\Request->send()
#2 /var/www/html/projcet_dev/vendor/langleyfoxall/xero-laravel/src/Wrappers/QueryWrapper.php(102): XeroPHP\Application->loadByGUID('\\XeroPHP\\Models...', '53469941-5bb8-4...')

@abhimanusharma
Copy link
Author

@calcinai How to resolve this bug?

@rodjsta
Copy link

rodjsta commented May 5, 2021

Are you able to access other contacts or other objects? Is your app still connected to Xero?

@abhimanusharma
Copy link
Author

@rodjsta I am not sure, but I am sending access token, Tenant Id, client id and client secret with every request, xero object is returning the correct object but could not able to get the contact or list of contacts. Same error is there.

@Josh-G
Copy link
Contributor

Josh-G commented May 6, 2021

not able to get the contact or list of contacts

You aren't able to pull any contacts at all?
If you decode your access token, can you definitely see the contacts scope in the scope array?
The access token is a JWT and can be decoded by standard JWT tools (for example https://jwt.io/ or any local jwt tool)

@abhimanusharma
Copy link
Author

@Josh-G Yes, I have contacts in my scope, I am not able to get contacts at all.

@wilr
Copy link

wilr commented Sep 16, 2021

@abhimanusharma I just came across the same issue and our issue was that I was naively using $tenant->id rather than $tenant->tenantId. Once I changed the code to use tenantId the error disappeared.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants