jlevers / selling-partner-api

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

access token #756

Closed jmshofstall closed 1 month ago

jmshofstall commented 2 months ago

Problem description:

Trying to upgrade from v5, I already have a model that stores the refresh token and access token with a function to get new tokens that works fine in v5 for multiple users/amazon accounts. In v7 I don't see a way to use the access token so how am I supposed to keep my stored tokens in sync?

jlevers commented 1 month ago

You can pass an implementation of TokenCache to SellingPartnerApi::seller() via the $cache parameter...I think you should be able to implement the storage mechanism you need that way. The library handles fetching cached tokens for you, so all you need to do is implement the TokenCache interface and the library will automatically use it to cache and retrieve tokens.

GWTorstenDEV commented 1 month ago

Hi @jlevers,

can you give us an code example for?

  1. get the current accesstoken like the old v5 Function onUpdateCredentials.
  2. set the accesstoken like the old v5 Parameter accessToken to speed up the calls

I'll need to store the accesstoken in the database (no memory).

EDIT: I'll think we misunderstand us in this thread https://github.com/jlevers/selling-partner-api/issues/712

many thx.