Comments (7)
The repository methods to fetch data require a Context
object. This object requires an AccessToken
object and this is generated by using the AdminAuthenticator
. That has to be triggered manually.
There is no automatic refresh. Shopware also doesn't provide a refresh token for every grant type. A client credentials authentication token e.g. doesn't contain one.
The AccescToken
class has a isExpired
method which can be used to check if a new token is required. If the token is expired an there is a refresh token, a RefreshTokenGrantType
object can be created to reauthenticate. But this has to be done manually, too.
If the token used in the context object for the request is expired, Shopware will simply return 401 and the SDK will throw that as an exception.
from shopware-php-sdk.
Ok, it seems the reason is that, if you don't explicitly configure the AdminAuthenticator
options to retry at least once, it won't do it at all and the 10 minute token will simply expire. That should be made more obvious IMHO.
Should have looked into the logs first. Error still occurring.
from shopware-php-sdk.
Can I please get an answer on this:
Does the client not make sure that the access token stays valid?
Do I have to refresh it myself? I can't find an error with the code. It works fine for about 10 Minutes (the default token time limit) and then it throws the error in the title.
from shopware-php-sdk.
Do I have to refresh it myself? I can't find an error with the code. It works fine for about 10 Minutes (the default token time limit) and then it throws the error in the title.
With PasswordTypeGrantType, its by default alive for 10 minutes. You need to refresh the token afterward using RefreshTokenGrantType as hint from @SpiGAndromeda
If you want a longer duration access token, you can use ClientCredentialsGrantType instead
from shopware-php-sdk.
Related Issues (20)
- Cant get Transaction and Delivery Status HOT 1
- Don't cache entities HOT 5
- EntityRepository::searchIds does not throw ShopwareSearchResponseException HOT 3
- Does this sdk work with custom entities? HOT 3
- PHP 8.1 compatibility HOT 6
- EntityCollection is returned for empty results HOT 2
- Self signed certificate HOT 1
- GET Requests are not validated correctly HOT 2
- Call to a member function getSource() on null HOT 7
- Connecting properties, categories and tags to product (question) HOT 2
- Dieser Wert sollte nicht leer sein. c1051bb4-d103-4f74-8988-acbcafc7fdc3 HOT 2
- Transaction commit failed because the transaction has been marked for rollback only HOT 5
- Create Order Delivery HOT 2
- SDK version mismatch HOT 1
- Document download not possible
- Add support for criteria in SyncService / SyncPayload
- Allowed memory size exhausted HOT 3
- OrderReturnLineItemEntity is missing (part of Shopware Commercial plugin)
- dynamic properties and package versioning HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shopware-php-sdk.