Integrate OwnID into Salesforce Composable Storefront (PWA).
Administration > Site Development > Salesforce Commerce API Settings
. Its value is typically kv7kzm78
.{shortcode}
is your SFCC instance’s shortcode. The name default-ownid
is the default IDP name. If you have wish to setup a different IDP name, use that instead.
https://{shortcode}.api.commercecloud.salesforce.com
./idp-callback
for all relevant domains. Keep the /callback
in place. You can use a different endpoint if you wish, we will configure its value in the PWA in the next step. Just make sure to create a different endpoint than /callback
, because this one is used by other authentication flows of SLAS.
Value for example:What tenant will be used?
- Choose your tenant.Idp Name
- Enter default-ownid
or the name you used in the OwnID Console.Idp Client Id
- Enter the Client ID from the OwnID Console.Secret
- Enter the Client Secret from the OwnID Console.Scopes
- Enter openid profile email
.Redirect URL
- Enter https://{shortcode}.api.commercecloud.salesforce.com/shopper/auth/v1/idp/callback/default-ownid
, the value you had set in the Redirect URIs field in the OwnID Console.Auth URL
- Enter the Authorization Endpoint from the OwnID Console.Token URL
- Enter the Token Endpoint from the OwnID Console.Token Info URL
- Enter the Token Info Endpoint from the OwnID Console.User Info URL
- Enter the User Info Endpoint from the OwnID Console.Well Known URL
- Leave empty.Client Credentials in POST body?
- check the checkbox.Default IDP Claim Map
- Leave empty.Login Merge Claims
- Enter the value email
.Team Id
- Leave empty.Key Id
- Leave empty.Client ID
with the Client Id from the SLAS Admin UI.
ssr.js
(typically at overrides/app/ssr.js
) and add '*.ownid.com'
to both script-src
and connect-src
CSP headers.appId
field, use the app ID from the OwnID Console.
In the idpName
field, use the name you used in the SLAS IDP configuration, by default it is default-ownid
.
In the callbackEndpoint
field, use the endpoint you configured in the SLAS client redirect URI. We recommend on /idp-callback
.app/components/forms/login-fields.jsx
.app/components/forms/registration-fields.jsx
./idp-callback
.
Typically, it would be at pages/idp-callback/index.jsx
.
The UI in the snippet is only a recommendation, you can customize it to fit your needs.
The important bits are the call to window.ownid.completeAuthorizeFlow
and the handling of the usid
and code
query parameters.
In addition, make sure to handle an already authenticated user in already to avoid a redirect loop. This is done in the snippet using the useCurrentCustomer
hook.pages/account/index.jsx
) to handle post-registration flow.