janhenkes / teamleader-php-sdk

Teamleader API v2 PHP SDK
MIT License
16 stars 25 forks source link

Invalid access token, please acquire a new one. With webhook #31

Closed Mmalherbe closed 3 years ago

Mmalherbe commented 4 years ago

Hi!

I'm trying to automate my shopify into teamleader, with a webhook once a customer orders an item. I've allowed my redirect into the TeamLeader integration as it allows me to interact when I go to the URL with my browser. But the thing is that the webhook from shopify return me the fatal error that the access token is invalid. I'm not sure how to go on with this issue. As I lose the data sent by shopify once I require the 'aquire-access-token.php' into the script.

Sorry, not really a bug or issue with your sdk but more the lack of my knowledge and unable to find any help about this on google..

Thanks!

janhenkes commented 4 years ago

Hi @Mmalherbe ,

Can you share a code sample?

From what you're writing I think the missing step is that you should acquire an access token once manually, save it in a database (or a file even) and use this saved access token in the webhook script. Also, you should write some code in your webhook script to renew the access token once it's expired.

Maybe this helps you? Please let me know. Thanks, Jan