Skip to content

Cannot do POST /V1/carts/mine or PUT V1/guest-carts/{cartId} with Intergation tokens on Magento 2.4.6-p8 and 2.4.4-p12 #39730

Open
@ErnestsVerins

Description

@ErnestsVerins

Preconditions and environment

Magento version: 2.4.* ( Tested on 2.4.3, 2.4.4 and 2.4.6)

On Magento 2.3.5 I was able to do POST /V1/carts/mine / POST /V1/carts/mine/items OR PUT V1/guest-carts/{cartId} with Intergation tokens, but on Magento 2.4.* it doesn't work.

Steps to reproduce

  1. In admin under System>Extensions>Integrations create a new integration

  2. Do POST /rest/default/V1/carts with Auth. type OAuth 1.0, Signature Method HMAC-SHA256 and enter the Integration keys and tokens there. As a result, quote id value will be generated;

  3. Do POST /rest/default/V1/carts/mine/items with the same Auth. and with body (add the quote_id that was created with the previous request):

{
"cartItem": {
"sku": "{sku}",
"qty": 1,
"quote_id": {quote_id}
}
}

  1. Do POST rest/default/V1/guest-carts with the same Auth. type to get customer quote id.
  2. Do PUT rest/default/V1/guest-carts/{cart_id} with the same Auth. and body

{
"customerId": {customer_id},
"storeId": 0
}

Expected result

  • POST /rest/default/V1/carts/mine/items - item gets added to the cart
  • PUT rest/default/V1/guest-carts/{cart_id} - the customer has been assigned to the specified cart

Actual result

POST /V1/carts/mine / V1/carts/mine/items:

{
    "message": "\"%fieldName\" is required. Enter and try again.",
    "parameters": {
        "fieldName": "customerId"
    }
}

PUT V1/guest-carts/{cartId} :

{
    "message": "You don't have the correct permissions to assign the customer to the cart."
}

Additional information

I'm investigating this, because the third party needs these requests to work with the integration token the same way as on the old setup (2.3.5).

In admin under System>Extensions>Integrations I have created an integration:

  • Callback URL is empty;
  • Identity link URL is empty;
  • Resource Access is All

In admin Stores>Configurations>Services>OAuth>Consumer Settings "Allow OAuth Access Tokens to be used as standalone Bearer tokens" is set to Yes. Expiration Period is set to 30000.

Proposed solution

No response

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: APIsComponent: ApiUse with concrete module component label E.g. "Component: Api" + "Catalog"Issue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Reported on 2.4.6Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

    Type

    No type

    Projects

    Status

    Ready for Development

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions