403 error encountered when attempting to remove a product from the mini basket.

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
akropivko
Posts: 36
Joined: 20 Jan 2021, 12:49

403 error encountered when attempting to remove a product from the mini basket.

Post by akropivko » 15 Oct 2023, 15:55

Hi!
Removing a product item from mini basket by json
/jsonapi/basket?id=default&related=product&relatedid=0&_token=3gWii4rfC7E2iStRMZwXsENWX2RMzAtXBexKdzpY

causes a 403 error:

{"errors": [
{"title": "Not allowed for this resource"}]}

Any ideas how to fix this?

Version - 2023.10.x-dev
Integration - Laravel
System - Windows10

User avatar
aimeos
Administrator
Posts: 7895
Joined: 01 Jan 1970, 00:00

Re: 403 error encountered when attempting to remove a product from the mini basket.

Post by aimeos » 16 Oct 2023, 07:07

What is the JSON request you've sent?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

akropivko
Posts: 36
Joined: 20 Jan 2021, 12:49

Re: 403 error encountered when attempting to remove a product from the mini basket.

Post by akropivko » 16 Oct 2023, 17:03

This - /jsonapi/basket?id=default&related=product&relatedid=0&_token=3gWii4rfC7E2iStRMZwXsENWX2RMzAtXBexKdzpY
It is the default AI request to delete a product item from the minibasket. Despite the 403 mistake, the product item had been deleted on my local server, but had NOT been deleted on stage server - the same error. Actually I've recognized the error only when upploaded the project to the stage server.

akropivko
Posts: 36
Joined: 20 Jan 2021, 12:49

Re: 403 error encountered when attempting to remove a product from the mini basket.

Post by akropivko » 17 Oct 2023, 14:05

... and the same issue when trying to delete a subcategory in the backend -
Screenshot_56.jpg
Screenshot_56.jpg (38.39 KiB) Viewed 27626 times
The request is the default one -
/admin/default/jsonadm/catalog?locale=uk&id=24&_token=TL4Hjd172lwAvo0ucfm1CFNaqkVORxaJk6AaiLys

User avatar
aimeos
Administrator
Posts: 7895
Joined: 01 Jan 1970, 00:00

Re: 403 error encountered when attempting to remove a product from the mini basket.

Post by aimeos » 18 Oct 2023, 08:58

akropivko wrote: 16 Oct 2023, 17:03 This - /jsonapi/basket?id=default&related=product&relatedid=0&_token=3gWii4rfC7E2iStRMZwXsENWX2RMzAtXBexKdzpY
It is the default AI request to delete a product item from the minibasket. Despite the 403 mistake, the product item had been deleted on my local server, but had NOT been deleted on stage server - the same error. Actually I've recognized the error only when upploaded the project to the stage server.
Things to keep in mind:
- It must be an HTTP DELETE request (not GET or POST)
- The value of "relatedid" must be a valid position in the basket (you get valid URLs when you retrieve the basket)
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
aimeos
Administrator
Posts: 7895
Joined: 01 Jan 1970, 00:00

Re: 403 error encountered when attempting to remove a product from the mini basket.

Post by aimeos » 18 Oct 2023, 08:58

akropivko wrote: 17 Oct 2023, 14:05 ... and the same issue when trying to delete a subcategory in the backend -
The request is the default one -
/admin/default/jsonadm/catalog?locale=uk&id=24&_token=TL4Hjd172lwAvo0ucfm1CFNaqkVORxaJk6AaiLys
It looks like your web server denies DELETE requests due to its configuration.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply