-
Notifications
You must be signed in to change notification settings - Fork 40
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 when trying to retrieve contacts #45
Comments
I am also facing error while getting a single contact. I have scopes My $this->xero is returning the xero object successfully. is returning error.
|
Is never going to work. |
Issue here is refreshing the token, start on that first. |
Thank you,but how does a refresh code look like on the default,because i havent done anything myself,just the configuration as per the guidelines.I got the error while trying to get contacts.Sorry to bother you |
Its literaaly on the front page as a function in the code block where you got the first part. The token lasts 30 minutes, so you need to ensure you are refreshing the token to maintain access. |
Yes it is, i have to set that up some more? Call it in a way? I actually
thought the package handles everything from authorization to storing the
access token to refreshing the token. If you have a few minutes maybe you
can show me a demo on what goes in where and how do i get a contact maybe
…On Wed, May 5, 2021, 11:17 PM Seán McCabe ***@***.***> wrote:
Its literaaly on the front page as a function in the code block where you
got the first part.
here <https://github.com/langleyfoxall/xero-laravel#oauth-20-flow>
The token lasts 30 minutes, so you need to ensure you are refreshing the
token to maintain access.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#45 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANZM7BOUXTX3UXX2RXCY7TLTMGRUXANCNFSM44DVNXPQ>
.
|
Yes you need to call that function, safest is to call it before every Xero connection so ensure you have an active token. No it doesn't. All the code you need is on the frontpage, and it assumes you have a basic knowledge of laravel and PHP to then know how to store the data you've gotten. |
It's clearer now what i am expected to do. Incase of more clarifications
can i still reach out? Thank you
…On Wed, May 5, 2021, 11:35 PM Seán McCabe ***@***.***> wrote:
Yes you need to call that function, safest is to call it before every Xero
connection so ensure you have an active token.
No it doesn't.
It just gives you an easy way to handle that stuff, rather than
re-inventing the wheel everytime. You need to sort the storing of the token
and tenant id etc. (i.e. in a database or something) to call later.
All the code you need is on the frontpage, and it assumes you have a basic
knowledge of laravel and PHP to then know how to store the data you've
gotten.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#45 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANZM7BLUM3KQ7UWIBYMR3ATTMGTXNANCNFSM44DVNXPQ>
.
|
@seanmccabe My system has the correct contact id in $xero_auth as it is object of my db modal getting contact id from database. |
The error says you dont have permission to access that resource. So are you sure that contact uuid is within the tenant you have authorised and are passing through? |
Yes I have added that contact using that tanant and with package only but when I am trying to access that contact to add the invoice it is giving me the error I mentioned above. |
Did you manage to solve your errors?can i email you to help me a little? |
The errors aren't code related, you are trying to access a resource you don't have permission to view. So either:
This may be of help: |
Hello,i am new to Xero and i am trying to get my head around how to go about things,i am asking this here because i have exhausted my options .So i did everything well since i can get my app to request and get access tokens and tenant ID and choose an app from xero,thanks to a flawless documentation.When i got to the usage section,i created a route ;'about' just to test things and pasted this to its controller
`public function about()
{
$user = auth()->user();
$xero = new XeroApp(
new AccessToken(json_decode($user->xero_oauth_2_access_token)),
$user->xero_tenant_id
);
$contacts = $xero->contacts()->get();
dd($contacts);
}`
trying to access the about page,i get this error: Argument 1 passed to League\OAuth2\Client\Token\AccessToken::__construct() must be of the type array, null given, called in C:\xampp\htdocs\foodiez\app\Http\Controllers\HomeController.php on line 88
what could i be doing wrong.
Also to anyone who will respond to this,how do we add a contact to xero with the syntax offered by this package
The text was updated successfully, but these errors were encountered: