jlevers / selling-partner-api

A PHP client library for Amazon's Selling Partner API
BSD 3-Clause "New" or "Revised" License
408 stars 198 forks source link

How to call grantless operations (Notifications CreateDestination) without refresh token #786

Open Sobak opened 2 months ago

Sobak commented 2 months ago

Problem description:

Hi!

Both SP API docs from Amazon and the package readme state that for the grantless operations having a refresh token for the particular seller isn't a must.

refreshToken (string): The LWA refresh token of the SP API application to use to execute API requests. Required, unless you're only using grantless operations.

However, after checking all package APIs I could think of it seems there isn't a way to create a seller connector instance without providing a valid refresh token, because the package sends it to SP API at all times.

Is my understanding correct that it should be made optional for grantless operations? Any tips on how can I achieve it without writing my own code to build the entire request to SP API, handle the response with Saloon etc?

Context: I'm building a multi-seller application where I need to call CreateDestination for notifications without a context of specific seller.

geekworm-com commented 2 weeks ago

Here is some example codes, refer to #390 ,

jlevers commented 1 week ago

Have you tried giving a dummy refresh token? I believe that it should work fine, because I don't think we ever use the refresh token if you only make requests to grantless operations. Or at least that's definitely how I intended to build it...coulda messed something up.