bitranox/lib_shopware6_api

401 Client Error: Unauthorized for Access token - Access token could not be verified

rubberfashion opened this issue · 4 comments

  • **I'm submitting a ... **

    • bug report
    • feature request
    • support request
  • What is the current behavior?
    Traceback (most recent call last):
    File "...\virtualenvs\shopware-automation-OzY02_Lq-py3.10\lib\site-packages\lib_shopware6_api_base\lib_shopware6_api_base.py", line 753, in _request
    response.raise_for_status()
    File "...\Cache\virtualenvs\shopware-automation-OzY02_Lq-py3.10\lib\site-packages\requests\models.py", line 960, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
    requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: XXX/api/search/product-media

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "...\Cache\virtualenvs\shopware-automation-OzY02_Lq-py3.10\lib\site-packages\click\core.py", line 1055, in main
rv = self.invoke(ctx)
File "...\Cache\virtualenvs\shopware-automation-OzY02_Lq-py3.10\lib\site-packages\click\core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "...\Cache\virtualenvs\shopware-automation-OzY02_Lq-py3.10\lib\site-packages\click\core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "...\Cache\virtualenvs\shopware-automation-OzY02_Lq-py3.10\lib\site-packages\typer\main.py", line 500, in wrapper
return callback(**use_params) # type: ignore
File ".../shopware_automation/main.py", line 39, in main
product_media = api.product.search_product_medias(payload=filter)
File "...\Cache\virtualenvs\shopware-automation-OzY02_Lq-py3.10\lib\site-packages\lib_shopware6_api\sub_product.py", line 533, in search_product_medias
response_dict = self._admin_client.request_post_paginated("search/product-media", payload)
File "...\Cache\virtualenvs\shopware-automation-OzY02_Lq-py3.10\lib\site-packages\lib_shopware6_api_base\lib_shopware6_api_base.py", line 538, in request_post_paginated
response_dict = self._request_paginated(http_method="post", request_url=request_url, payload=payload, junk_size=junk_size)
File "...\Cache\virtualenvs\shopware-automation-OzY02_Lq-py3.10\lib\site-packages\lib_shopware6_api_base\lib_shopware6_api_base.py", line 633, in _request_paginated
partial_data = self._make_request(http_method=http_method, request_url=request_url, payload=payload_dict)
File "...\Cache\virtualenvs\shopware-automation-OzY02_Lq-py3.10\lib\site-packages\lib_shopware6_api_base\lib_shopware6_api_base.py", line 698, in _make_request
response = self._request(http_method=http_method, request_url=request_url, payload=payload_dict)
File "...\Cache\virtualenvs\shopware-automation-OzY02_Lq-py3.10\lib\site-packages\lib_shopware6_api_base\lib_shopware6_api_base.py", line 759, in _request
raise ShopwareAPIError(f"{exc}{detailed_error}")
lib_shopware6_api_base.conf_shopware6_api_base_classes.ShopwareAPIError: 401 Client Error: Unauthorized for url: XXX/api/search/product-media : {"errors":[{"code":"9","status":"401","title":"The resource owner or authorization server denied the request.","detail":"Access token could not be verified"}]}

  • **If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem
    After arround 10 minutes the server error occure. Sometimes the error occure, sometimes not.
    Looks like Server API Error. If you catch exeption and retry the request the API get a new token.

  • What is the expected behavior?
    get refresh token without error

  • Please tell us about your environment:

  • Release Number of the Repository used : 2.0.2
  • Python Version : 3.10
  • OS, OS Version : Win11

ok, I will make an additional retry - pls standby for the new release later today/tomorrow

please update https://github.com/bitranox/lib_shopware6_api_base to version 2.0.7 and let me know if the issue is resolved
yours sincerely
bitranox

@rubberfashion please let me know if its working now

Have made several attempts without an error. Thanks!!