You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To integrate this library with your PWA Kit application you can use the `CommerceApiProvider` directly assuming that you use the `withReactQuery` higher order component to wrap your `AppConfig` component. Below is a snippet of how this is accomplished.
49
49
@@ -54,6 +54,10 @@ import {CommerceApiProvider} from '@salesforce/commerce-sdk-react'
_💡 This section assumes you have read and completed the [Authorization for Shopper APIs](https://developer.salesforce.com/docs/commerce/commerce-api/guide/authorization-for-shopper-apis.html) guide._
127
136
128
-
To help reduce boilerplate code for managing shopper authentication, by default, this library automatically initializes shopper session and manages the tokens for developers. Currently, the library supports the [Public Client login flow](https://developer.salesforce.com/docs/commerce/commerce-api/guide/slas-public-client.html).
129
-
130
-
Commerce-react-sdk supports both public and private flow of the [Authorization for Shopper APIs](https://developer.salesforce.com/docs/commerce/commerce-api/guide/authorization-for-shopper-apis.html) guide._
131
-
You can choose to use either public or private slas to login. By default, public flow is enabled.
132
-
133
-
#### How private SLAS works
134
-
This section assumes you read and understand how [private SLAS](https://developer.salesforce.com/docs/commerce/commerce-api/guide/slas-private-client.html) flow works
135
-
136
-
To enable private slas flow, you need to pass your secret into the CommercerProvider via clientSecret prop.
137
-
**Note** You should only use private slas if you know you can secure your secret since commercer-sdk-react runs isomorphically.
By default, a warning as below will be displayed on client side to remind developers to always keep their secret safe and secured.
165
-
```js
166
-
'You are potentially exposing SLAS secret on browser. Make sure to keep it safe and secure!'
167
-
```
168
-
You can disable this warning by using CommerceProvider prop `silenceWarnings`
137
+
To help reduce boilerplate code for managing shopper authentication, by default, this library automatically initializes shopper session and manages the tokens for developers. Commerce-sdk-react supports both the [SLAS Public Client login flow](https://developer.salesforce.com/docs/commerce/commerce-api/guide/slas-public-client.html) and [SLAS Private Client login flow](https://developer.salesforce.com/docs/commerce/commerce-api/guide/slas-private-client.html). Authorization using a private client is supported in PWA Kit 3.5 and later, and is the recommended authorization workflow.
169
138
170
-
```js
171
-
constAppConfig= ({children}) => {
172
-
return (
173
-
<CommerceApiProvider
174
-
clientId="12345678-1234-1234-1234-123412341234"
175
-
organizationId="f_ecom_aaaa_001"
176
-
proxy="localhost:3000/mobify/proxy/api"
177
-
redirectURI="localhost:3000/callback"
178
-
siteId="RefArch"
179
-
shortCode="12345678"
180
-
locale="en-US"
181
-
currency="USD"
182
-
clientSecret="<your-slas-private-secret>"
183
-
silenceWarnings={true}
184
-
>
185
-
{children}
186
-
</CommerceApiProvider>
187
-
)
188
-
}
189
-
```
139
+
#### Using a private SLAS client
140
+
To enable a private client, see [Use a SLAS Private Client](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/use-a-slas-private-client.html).
0 commit comments