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

API DELETE /api/api-access : Error when deleting a api access #35306

Closed
2 tasks done
Progi1984 opened this issue Feb 9, 2024 · 1 comment · Fixed by #35368 or PrestaShop/ps_apiresources#14
Closed
2 tasks done
Assignees
Labels
9.0.x Branch API Bug Type: Bug Major Severity: major bug > https://build.prestashop.com/news/severity-classification Verified The issue has been reproduced

Comments

@Progi1984
Copy link
Contributor

Progi1984 commented Feb 9, 2024

Prerequisites

Describe the bug and add attachments

I can remove an API Access but it returns an errors

Expected behavior

Should not be allowed

Steps to reproduce

  1. Enable Authorization Server
  2. Create an API Access with api_access_write
  3. Copy the client secret
  4. Try to use this request :
curl -X 'DELETE' \
  'https://prestashop.php82.local/admin-dev/index.php/api/api-access/2' \
  -H 'accept: */*' \
  -H 'Authorization: 086f3e35b23ed804886f3455117a88d2'
  1. 🎉 The API Access is removed BUT
  2. The response is in error : 401 Unauthorized
{
  "type": "https://tools.ietf.org/html/rfc2616#section-10",
  "title": "An error occurred",
  "detail": "Full authentication is required to access this resource.",
  "trace": [
    {
      "namespace": "",
      "short_class": "",
      "class": "",
      "type": "",
      "function": "",
      "file": "/home/flefevre/projects/prestashop/vendor/symfony/security-http/Firewall/ExceptionListener.php",
      "line": 232,
      "args": []
    },
    {
      "namespace": "Symfony\\Component\\Security\\Http\\Firewall",
      "short_class": "ExceptionListener",
      "class": "Symfony\\Component\\Security\\Http\\Firewall\\ExceptionListener",
      "type": "->",
      "function": "throwUnauthorizedException",
      "file": "/home/flefevre/projects/prestashop/vendor/symfony/security-http/Firewall/ExceptionListener.php",
      "line": 189,
      "args": []
    },
    {
      "namespace": "Symfony\\Component\\Security\\Http\\Firewall",
      "short_class": "ExceptionListener",
      "class": "Symfony\\Component\\Security\\Http\\Firewall\\ExceptionListener",
      "type": "->",
      "function": "startAuthentication",
      "file": "/home/flefevre/projects/prestashop/vendor/symfony/security-http/Firewall/ExceptionListener.php",
      "line": 148,
      "args": []
    },
    {
      "namespace": "Symfony\\Component\\Security\\Http\\Firewall",
      "short_class": "ExceptionListener",
      "class": "Symfony\\Component\\Security\\Http\\Firewall\\ExceptionListener",
      "type": "->",
      "function": "handleAccessDeniedException",
      "file": "/home/flefevre/projects/prestashop/vendor/symfony/security-http/Firewall/ExceptionListener.php",
      "line": 103,
      "args": []
    },
    {
      "namespace": "Symfony\\Component\\Security\\Http\\Firewall",
      "short_class": "ExceptionListener",
      "class": "Symfony\\Component\\Security\\Http\\Firewall\\ExceptionListener",
      "type": "->",
      "function": "onKernelException",
      "file": "/home/flefevre/projects/prestashop/vendor/symfony/event-dispatcher/Debug/WrappedListener.php",
      "line": 116,
      "args": []
    },
    {
      "namespace": "Symfony\\Component\\EventDispatcher\\Debug",
      "short_class": "WrappedListener",
      "class": "Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener",
      "type": "->",
      "function": "__invoke",
      "file": "/home/flefevre/projects/prestashop/vendor/symfony/event-dispatcher/EventDispatcher.php",
      "line": 220,
      "args": []
    },
    {
      "namespace": "Symfony\\Component\\EventDispatcher",
      "short_class": "EventDispatcher",
      "class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
      "type": "->",
      "function": "callListeners",
      "file": "/home/flefevre/projects/prestashop/vendor/symfony/event-dispatcher/EventDispatcher.php",
      "line": 56,
      "args": []
    },
    {
      "namespace": "Symfony\\Component\\EventDispatcher",
      "short_class": "EventDispatcher",
      "class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
      "type": "->",
      "function": "dispatch",
      "file": "/home/flefevre/projects/prestashop/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php",
      "line": 139,
      "args": []
    },
    {
      "namespace": "Symfony\\Component\\EventDispatcher\\Debug",
      "short_class": "TraceableEventDispatcher",
      "class": "Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcher",
      "type": "->",
      "function": "dispatch",
      "file": "/home/flefevre/projects/prestashop/vendor/symfony/http-kernel/HttpKernel.php",
      "line": 239,
      "args": []
    },
    {
      "namespace": "Symfony\\Component\\HttpKernel",
      "short_class": "HttpKernel",
      "class": "Symfony\\Component\\HttpKernel\\HttpKernel",
      "type": "->",
      "function": "handleThrowable",
      "file": "/home/flefevre/projects/prestashop/vendor/symfony/http-kernel/HttpKernel.php",
      "line": 91,
      "args": []
    },
    {
      "namespace": "Symfony\\Component\\HttpKernel",
      "short_class": "HttpKernel",
      "class": "Symfony\\Component\\HttpKernel\\HttpKernel",
      "type": "->",
      "function": "handle",
      "file": "/home/flefevre/projects/prestashop/vendor/symfony/http-kernel/Kernel.php",
      "line": 197,
      "args": []
    },
    {
      "namespace": "Symfony\\Component\\HttpKernel",
      "short_class": "Kernel",
      "class": "Symfony\\Component\\HttpKernel\\Kernel",
      "type": "->",
      "function": "handle",
      "file": "/home/flefevre/projects/prestashop/admin-dev/index.php",
      "line": 82,
      "args": []
    }
  ]
}

PrestaShop version(s) where the bug happened

9.0.x

PHP version(s) where the bug happened

8.2

If your bug is related to a module, specify its name and its version

No response

Your company or customer's name goes here (if applicable).

@PrestaShopCorp

@Progi1984 Progi1984 added Bug Type: Bug New New issue not yet processed by QA labels Feb 9, 2024
@florine2623 florine2623 added Minor Severity: minor bug > https://build.prestashop.com/news/severity-classification Ready Status: Issue is ready to be worked on API Verified The issue has been reproduced 9.0.x Branch and removed New New issue not yet processed by QA labels Feb 9, 2024
@jolelievre jolelievre added Major Severity: major bug > https://build.prestashop.com/news/severity-classification and removed Minor Severity: minor bug > https://build.prestashop.com/news/severity-classification labels Feb 12, 2024
@M0rgan01
Copy link
Contributor

This is not the cause of the problem, but 'Authorization: 086f3e35b23ed804886f3455117a88d2' should be 'Authorization: Bearer 086f3e35b23ed804886f3455117a88d2'

To take into account during the test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
9.0.x Branch API Bug Type: Bug Major Severity: major bug > https://build.prestashop.com/news/severity-classification Verified The issue has been reproduced
Projects
None yet
4 participants