When user re-open the storefront after access token expires, the basesites API call will fail due to expired access token. And blank screen will be displayed instead of the expected login page.
Tell us the version of Spartacus
Library version: 4.2.1, B2C, CSR
To Reproduce
Steps to reproduce the behavior:
create a Storefront using schematics based on version 4.2.1:
yarn start to launch the storefront. Log in storefront as usual.
close the browser, wait until the access token expires. In order to make this issue easier to reproduce, you can change the property oauth2.accessTokenValiditySeconds in local.properties of your local hybris instance to a smaller value.
After the access token expires, open the browser again, access Spartacus storefront.
This time you can observe a blank screen with some error requests found in Chrome dev tools:
Describe the bug
When user re-open the storefront after access token expires, the basesites API call will fail due to expired access token. And blank screen will be displayed instead of the expected login page.
Tell us the version of Spartacus
To Reproduce Steps to reproduce the behavior:
yarn start to launch the storefront. Log in storefront as usual.
close the browser, wait until the access token expires. In order to make this issue easier to reproduce, you can change the property
oauth2.accessTokenValiditySeconds
in local.properties of your local hybris instance to a smaller value.After the access token expires, open the browser again, access Spartacus storefront.
This time you can observe a blank screen with some error requests found in Chrome dev tools:
https://localhost:9002/occ/v2/basesites?fields=baseSites(uid,defaultLanguage(isocode),urlEncodingAttributes,urlPatterns,stores(currencies(isocode),defaultCurrency(isocode),languages(isocode),defaultLanguage(isocode)),theme,defaultPreviewCatalogId,defaultPreviewCategoryCode,defaultPreviewProductCode)&lang=en&curr=USD
error message: Access token expired: ZHjV7wYfDUtWxUa5ePewZDsL-9Q
https://localhost:9002/authorizationserver/oauth/revoke
error message: Invalid access token: ZHjV7wYfDUtWxUa5ePewZDsL-9Q
https://localhost:9002/occ/v2/cms/pages?pageType=ContentPage&pageLabelOrId=%2Flogin&lang=en&curr=USD
"Base site cms doesn't exist", type: "InvalidResourceError"
Expected behavior
User will be redirected to log in page.