SAP / spartacus

Spartacus is a lean, Angular-based JavaScript storefront for SAP Commerce Cloud that communicates exclusively through the Commerce REST API.
Apache License 2.0
744 stars 389 forks source link

Add a function to retrieve the userId according to the configuration. #2497

Closed plabadie closed 5 years ago

plabadie commented 5 years ago

See master ticket GH-1092

For this to work, we need to :

plabadie commented 5 years ago

PR #2524

plabadie commented 5 years ago

Test info

Apart from the foundation work mentioned in the ticket description, I implemented the userId change in one facade function: the update password.

By default, we intend to use the userId as a default and allow overrides to fall back to using emails.

HOWEVER

Since 1905 isn't released yet, we are going to keep the email as default for now and enable the use of customer Id with the config override,

Right now, by default, you should see the email in the call to the update password endpoint.

http://backendserver/rest/v2/electronics-spa/users/email@domain.com/password?lang=en&curr=USD

Then, you can apply the configuration override with the backend.occ.userIdentifier property and setting it to customerId. The storefront is expected to switch to using customerIds in the url

StorefrontModule.withConfig({
      backend: {
        occ: {
          userIdentifier: 'uid',
        },
      },
    })

With the config override, updating the password will be done with an url that looks like:

http://backendserver/rest/v2/electronics-spa/users/e57924e5-cafe-4b58-997d-9d684367cab8/password?lang=en&curr=USD
plabadie commented 5 years ago

Doc input here: https://github.com/SAP/cloud-commerce-spartacus-storefront/pull/2548/files

plabadie commented 5 years ago

Won't fix, the solution evolved. See GH-1092.