magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

GraphQl. Retrieve customer's shopping cart without an authorization token

Open atwixfirster opened this issue 5 years ago • 10 comments

Preconditions (*)

  1. Sample data
  2. Login as Veronica Costello
  3. Add any product(s) into a shopping cart

Steps to reproduce (*)

  1. Copy PHPSESSID value from a browser window
27373-01
  1. Set PHPSESSID in a header
27373-02
  1. Run the next GraphQL query to retrieve a customer's cart
{
  cart(cart_id: "kSjlU0dTeaH9CUuaRGFSUTOejwTN9ZLn") {
    id
    items {
      id
      quantity
      product {
        sku
      }
    }
  }
}

Expected result (*)

  1. GraphQl should use an Authorization token (Bearer) ONLY to retrieve a customer's cart.
27373-04

Actual result (*)

  1. Guest sees products which customer has been added into shopping cart.
27373-03

atwixfirster avatar Apr 29 '20 11:04 atwixfirster

Hi @atwixfirster. Thank you for your report. To help us process this issue please make sure that you provided the following information:

  • [ ] Summary of the issue
  • [ ] Information on your environment
  • [ ] Steps to reproduce
  • [ ] Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

@atwixfirster do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • [ ] yes
  • [ ] no

m2-assistant[bot] avatar Apr 29 '20 11:04 m2-assistant[bot]

Fix provided in https://github.com/magento/magento2/pull/27373

atwixfirster avatar Apr 29 '20 11:04 atwixfirster

Hi @dmytro-ch. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [x] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • [x] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [x] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • [ ] 5. Add label Issue: Confirmed once verification is complete.

  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

m2-assistant[bot] avatar Apr 29 '20 11:04 m2-assistant[bot]

Confirmed with PO that is was a requirement to support both - token and session. Sorry, but I need to close this issue.

lenaorobei avatar Apr 30 '20 15:04 lenaorobei

Hi @atwixfirster. Thank you for your report. The issue has been fixed in magento/magento2#27373 by @atwixfirster in 2.4-develop branch Related commit(s):

The fix will be available with the upcoming 2.4.1 release.

slavvka avatar Jun 05 '20 15:06 slavvka

Hi @slavvka, why is this fixed as a bug while @lenaorobei confirmed this was a requirement?

I think the issue was that the PWA and Magento shouldn't be in the same root folder. Deleting this functionality for all Magento users to fix something for someone who installed PWA and Magento in the same folder should not be the way to go. I think @atwixfirster should change his cookie path and it would be fixed in that way while leaving the functionality for using the Session ID.

Now it's not possible to combine GraphQL calls that need a bearer token with basic-auth for a staging environment, right?

I made a PR to put back this functionality: https://github.com/magento/magento2/pull/35004

jesse-deboer avatar Jan 21 '22 13:01 jesse-deboer

Now it's not possible to combine GraphQL calls that need a bearer token with basic-auth for a staging environment, right?

Hi, @jesse-deboer !

We used Bearer with enabled Basic Auth without any issues.

And yes, @lenaorobei has provided the expected result here, so I believe your PR is correct one.

Thanks

atwixfirster avatar Jan 21 '22 13:01 atwixfirster

:white_check_mark: Jira issue https://jira.corp.magento.com/browse/AC-2244 is successfully created for this GitHub issue.

github-jira-sync-bot avatar Feb 01 '22 14:02 github-jira-sync-bot

:white_check_mark: Confirmed by @engcom-Hotel. Thank you for verifying the issue.
Issue Available: @engcom-Hotel, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

m2-assistant[bot] avatar Feb 01 '22 14:02 m2-assistant[bot]

The way GQL works now is that we support both Session and Token - any would count for accessing authenticated content. It is the product intention to phase out "session" support, but there are two problems with this:

  • one is that since it's supported, there are clients that depend on it
  • removing sessions (and we have tried) caused misbehavior of some capabilities that gathered their data from the actual session like "Tax".

cpartica avatar Feb 08 '22 15:02 cpartica

@magento give me 2.4-develop instance

engcom-Lima avatar Sep 15 '22 09:09 engcom-Lima

Hi @engcom-Lima. Thank you for your request. I'm working on Magento instance for you.

Hi @engcom-Lima, here is your Magento Instance: https://5f73f7470fe7be8f2ce3f53d2a3e701f.instances.magento-community.engineering Admin access: https://5f73f7470fe7be8f2ce3f53d2a3e701f.instances.magento-community.engineering/admin_09e8 Login: 4b31d6a5 Password: 7656033af129