Kyon147 / laravel-shopify

A full-featured Laravel package for aiding in Shopify App development
MIT License
363 stars 107 forks source link

API Requests in scheduled jobs #325

Closed tom-gurney closed 3 months ago

tom-gurney commented 3 months ago

hello there,

not a bug or feature request, just after some pointers.

I'm looking to create a simple product import app for a client, products will come from a CSV file, uploaded to an FTP server at fixed intervals. I want to read that file every X minutes/hours/whatever and import any additional products into Shopify.

I've got a basic Shopify app set up following the installation guide, but I'm wondering how to send API requests in a scheduled job.

I've had a look at https://github.com/Kyon147/laravel-shopify/issues/313 where someone is doing something similar, but I'm not 100% clear on how to achieve what I want.

I was hoping to do something like this:

$shop = Auth::user()
// or
$shop = Auth::loginUsingId(1);

$res = $shop->api()->rest('etc', 'etc');

but I'm getting [API] Invalid API key or access token (unrecognized login or wrong password) back from that.

any suggestions would be great.

tom-gurney commented 3 months ago

(hold fire, I could be an idiot and forgot to comment out the password cast on the user model)

tom-gurney commented 3 months ago

(can confirm, am idiot)