Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
1 of 3 tasks
rubberfashion opened this issue Apr 11, 2022 · 4 comments
Closed
1 of 3 tasks
Assignees
Labels
bug Something isn't working

Comments

@rubberfashion
Copy link

  • **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
@bitranox
Copy link
Owner

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

bitranox added a commit to bitranox/lib_shopware6_api_base that referenced this issue Apr 11, 2022
--------
2022-04-12: retry the request (experimental, but not harmful at all) if failed.
  - issue bitranox/lib_shopware6_api#1
  - sometimes (seldom, after about 10 minutes connected) we got: "error code: 9, status: 401
    The resource owner or authorization server denied the request, detail: Access token could not be verified."
  - it seems to work when retry the request
@bitranox
Copy link
Owner

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

@bitranox bitranox added the bug Something isn't working label Apr 11, 2022
@bitranox bitranox self-assigned this Apr 11, 2022
@bitranox
Copy link
Owner

@rubberfashion please let me know if its working now

@rubberfashion
Copy link
Author

Have made several attempts without an error. Thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants