SalesforceCommerceCloud / pwa-kit

React-based JavaScript frontend framework to create a progressive web app (PWA) storefront for Salesforce B2C Commerce.
https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/pwa-kit-overview.html
BSD 3-Clause "New" or "Revised" License
276 stars 124 forks source link

[FEATURE] Support Agent Login 👔 #1849

Open johnboxall opened 2 weeks ago

johnboxall commented 2 weeks ago

PWA Kit could support an "Agent Login" mode that interact with SLAS Trusted Agent on Behalf Of. This mode would allow customer agents to shop the store on behalf of a customer, helping them complete their checkout.

Trusted Agent logins do not have a refresh token, so custom logic is required around authorization.

<CommerceApiProvider> accepts a fetchedToken prop which bypasses the regular authentication flow.

If you want to make this work today, you'd like need to alter the <AppConfig> component a conditionals to detect the agent login flow.

I'm not entirely sure how you'd handle the expiry of the token. You might need some custom logic that would detect that the token is expired and reload the app through the agent flow.