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

Consume new version of the commerce-sdk-isomorphic to enable Phased Launches support HTTP Basic Auth #1153

Merged
merged 4 commits into from
Apr 28, 2023

Conversation

alexvuong
Copy link
Collaborator

@alexvuong alexvuong commented Apr 26, 2023

Description

If a customer enables storefront protection on ECOM (so common could be considered the default in non-prod environment) it requires the HTTP Basic Auth header passed via the HTTP Request header authorization.

This messes with the authorization header used to send requests to SCAPI.

To resolve, this, we should look to transition commerce-sdk-isomorphic to use fetch and pass fetch(url, {credentials: 'omit'}) to disable browser's default behaviour of forwarding previously used basic auth headers.

Types of Changes

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Documentation update
  • Breaking change (could cause existing functionality to not work as expected)
  • Other changes (non-breaking changes that does not fit any of the above)

Breaking changes include:

  • Removing a public function or component or prop
  • Adding a required argument to a function
  • Changing the data type of a function parameter or return value
  • Adding a new peer dependency to package.json

Changes

  • upgrade commerce-isomorphic to 1.10.1

How to Test-Drive This PR

-boost up retail app

  • Verify that the network calls is using native fetch, and no cookie is being sent
    image

Checklists

General

  • Changes are covered by test cases
  • CHANGELOG.md updated with a short description of changes (not required for documentation updates)

Accessibility Compliance

You must check off all items in one of the follow two lists:

  • There are no changes to UI

or...

Localization

  • Changes include a UI text update in the Retail React App (which requires translation)

@alexvuong alexvuong self-assigned this Apr 26, 2023
@alexvuong alexvuong marked this pull request as ready for review April 26, 2023 23:32
@alexvuong alexvuong requested a review from a team as a code owner April 26, 2023 23:32
@@ -16,7 +16,13 @@ describe('Shopper Baskets hooks', () => {
const unimplemented = getUnimplementedEndpoints(ShopperBaskets, queries, mutations)
// If this test fails: create a new query hook, add the endpoint to the mutations enum,
// or add it to the `expected` array with a comment explaining "TODO" or "never" (and why).
expect(unimplemented).toEqual([])
expect(unimplemented).toEqual([
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version 1.10.1 adds some more basket mutations.

Copy link
Collaborator

@kevinxh kevinxh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

I guess this is how you include cookies right?

<CommerceApiProvider
  fetchOptions={{credentials: 'include'}}
/ >

@alexvuong alexvuong merged commit 4eafb65 into v3 Apr 28, 2023
bfeister added a commit that referenced this pull request May 9, 2023
* v3:
  fix: remove device-context and detect-device-type (#1168)
  Dependency updates (#1170)
  [Snyk] Security upgrade cosmiconfig from 7.1.0 to 8.0.0 (#1145)
  [V3] Remove `cross-fetch` from `template-retail-react-app` (#1160)
  [v3] Add suffix to ssr build files (#1158)
  Consume new version of the commerce-sdk-isomorphic to enable Phased Launches support HTTP Basic Auth (#1153)

# Conflicts:
#	packages/commerce-sdk-react/package-lock.json
#	packages/internal-lib-build/package-lock.json
#	packages/pwa-kit-runtime/package-lock.json
#	packages/template-retail-react-app/package-lock.json
bfeister added a commit that referenced this pull request May 9, 2023
…xtensibility-algo-refactor + regen lockfiles

* feature/template-extensibility:
  regen package lockfiles
  fix: remove device-context and detect-device-type (#1168)
  Dependency updates (#1170)
  [Snyk] Security upgrade cosmiconfig from 7.1.0 to 8.0.0 (#1145)
  [V3] Remove `cross-fetch` from `template-retail-react-app` (#1160)
  [v3] Add suffix to ssr build files (#1158)
  Consume new version of the commerce-sdk-isomorphic to enable Phased Launches support HTTP Basic Auth (#1153)

# Conflicts:
#	package-lock.json
#	packages/commerce-sdk-react/package-lock.json
#	packages/internal-lib-build/package-lock.json
#	packages/my-extended-retail-app/package-lock.json
#	packages/pwa-kit-create-app/package-lock.json
#	packages/pwa-kit-dev/package-lock.json
#	packages/pwa-kit-react-sdk/package-lock.json
#	packages/pwa-kit-runtime/package-lock.json
#	packages/template-retail-react-app/app/hooks/use-einstein.test.js
#	packages/template-retail-react-app/package-lock.json
#	packages/template-typescript-minimal/package-lock.json
#	packages/test-commerce-sdk-react/package-lock.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants