Skip to content

Commit c646e44

Browse files
authored
@W-20443849 Set default passwordless mode to 'email' for apps created via pwa-kit-create-app (#3526)
1 parent 22b6a36 commit c646e44

File tree

6 files changed

+16
-19
lines changed

6 files changed

+16
-19
lines changed

packages/commerce-sdk-react/src/auth/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1272,7 +1272,7 @@ class Auth {
12721272
async authorizePasswordless(parameters: AuthorizePasswordlessParams) {
12731273
const usid = this.get('usid')
12741274
// Default to 'callback' mode for backward compatibility as older versions of the template-retail-react-app
1275-
// expect this mode. Newer versions should explicitly set mode.
1275+
// do not pass the mode parameter. Newer versions should explicitly pass the mode.
12761276
const mode = parameters.mode || 'callback'
12771277
const callbackURI = parameters.callbackURI || this.passwordlessLoginCallbackURI
12781278
const locale = this.locale

packages/pwa-kit-create-app/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

22
## v3.15.0-dev (Nov 05, 2025)
3+
- Update `default.js` and `/_app-config/index.jsx` template to use email mode by default for passwordless login. [#3526] (https://github.com/SalesforceCommerceCloud/pwa-kit/pull/3526)
34

45
## v3.14.0 (Nov 04, 2025)
56
- Prompt text for Site ID should match actual validation: Site ID may contain uppercase or lowercase letters, numbers, hyphens, or underscores. - Updated Site ID validator regex to allow both uppercase and lowercase letters for improved compatibility, clarity. [#3410] (https://github.com/SalesforceCommerceCloud/pwa-kit/pull/3410)

packages/pwa-kit-create-app/assets/bootstrap/js/config/default.js.hbs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,12 @@ module.exports = {
6464
{{else}}
6565
enabled: false,
6666
{{/if}}
67+
// The mode of passwordless login. Valid values include 'email|callback'. Defaults to: 'callback'
68+
mode: 'email',
6769
// The callback URI, which can be an absolute URL (including third-party URIs) or a relative path set up by the developer.
68-
// Required in 'callback' mode; if missing, passwordless login defaults to 'sms' mode, which requires Marketing Cloud configuration.
69-
// If the env var `PASSWORDLESS_LOGIN_CALLBACK_URI` is set, it will override the config value.
70-
callbackURI:
71-
process.env.PASSWORDLESS_LOGIN_CALLBACK_URI || '/passwordless-login-callback',
70+
// Required in 'callback' mode. If the env var `PASSWORDLESS_LOGIN_CALLBACK_URI` is set, it will override the config value.
71+
// callbackURI:
72+
// process.env.PASSWORDLESS_LOGIN_CALLBACK_URI || '/passwordless-login-callback',
7273
// The landing path for passwordless login
7374
landingPath: '/passwordless-login-landing'
7475
},

packages/pwa-kit-create-app/assets/bootstrap/js/overrides/app/components/_app-config/index.jsx.hbs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ import {
2222
getEnvBasePath,
2323
slasPrivateProxyPath
2424
} from '@salesforce/pwa-kit-runtime/utils/ssr-namespace-paths'
25-
import {createUrlTemplate} from '@salesforce/retail-react-app/app/utils/url'
25+
import {buildAbsoluteUrl, createUrlTemplate} from '@salesforce/retail-react-app/app/utils/url'
2626
import createLogger from '@salesforce/pwa-kit-runtime/utils/logger-factory'
27-
import {isAbsoluteURL} from '@salesforce/retail-react-app/app/page-designer/utils'
2827

2928
import {CommerceApiProvider} from '@salesforce/commerce-sdk-react'
3029
import {withReactQuery} from '@salesforce/pwa-kit-react-sdk/ssr/universal/components/with-react-query'
@@ -80,9 +79,7 @@ const AppConfig = ({children, locals = {}}) => {
8079
const redirectURI = `${appOrigin}${getEnvBasePath()}/callback`
8180
const proxy = `${appOrigin}${getEnvBasePath()}${commerceApiConfig.proxyPath}`
8281
const slasPrivateClientProxyEndpoint = `${appOrigin}${getEnvBasePath()}${slasPrivateProxyPath}`
83-
const passwordlessLoginCallbackURI = isAbsoluteURL(passwordlessCallback)
84-
? passwordlessCallback
85-
: `${appOrigin}${getEnvBasePath()}${passwordlessCallback}`
82+
const passwordlessLoginCallbackURI = buildAbsoluteUrl(appOrigin, passwordlessCallback)
8683

8784
return (
8885
<CommerceApiProvider

packages/pwa-kit-create-app/assets/templates/@salesforce/retail-react-app/app/components/_app-config/index.jsx.hbs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ import {
2323
getEnvBasePath,
2424
slasPrivateProxyPath
2525
} from '@salesforce/pwa-kit-runtime/utils/ssr-namespace-paths'
26-
import {createUrlTemplate} from '@salesforce/retail-react-app/app/utils/url'
26+
import {buildAbsoluteUrl, createUrlTemplate} from '@salesforce/retail-react-app/app/utils/url'
2727
import createLogger from '@salesforce/pwa-kit-runtime/utils/logger-factory'
28-
import {isAbsoluteURL} from '@salesforce/retail-react-app/app/page-designer/utils'
2928

3029
import {CommerceApiProvider} from '@salesforce/commerce-sdk-react'
3130
import {withReactQuery} from '@salesforce/pwa-kit-react-sdk/ssr/universal/components/with-react-query'
@@ -80,9 +79,7 @@ const AppConfig = ({children, locals = {}}) => {
8079
const redirectURI = `${appOrigin}${getEnvBasePath()}/callback`
8180
const proxy = `${appOrigin}${getEnvBasePath()}${commerceApiConfig.proxyPath}`
8281
const slasPrivateClientProxyEndpoint = `${appOrigin}${getEnvBasePath()}${slasPrivateProxyPath}`
83-
const passwordlessLoginCallbackURI = isAbsoluteURL(passwordlessCallback)
84-
? passwordlessCallback
85-
: `${appOrigin}${getEnvBasePath()}${passwordlessCallback}`
82+
const passwordlessLoginCallbackURI = buildAbsoluteUrl(appOrigin, passwordlessCallback)
8683

8784
return (
8885
<CommerceApiProvider

packages/pwa-kit-create-app/assets/templates/@salesforce/retail-react-app/config/default.js.hbs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,12 @@ module.exports = {
6464
{{else}}
6565
enabled: false,
6666
{{/if}}
67+
// The mode of passwordless login. Valid values include 'email|callback'. Defaults to: 'callback'
68+
mode: 'email',
6769
// The callback URI, which can be an absolute URL (including third-party URIs) or a relative path set up by the developer.
68-
// Required in 'callback' mode; if missing, passwordless login defaults to 'sms' mode, which requires Marketing Cloud configuration.
69-
// If the env var `PASSWORDLESS_LOGIN_CALLBACK_URI` is set, it will override the config value.
70-
callbackURI:
71-
process.env.PASSWORDLESS_LOGIN_CALLBACK_URI || '/passwordless-login-callback',
70+
// Required in 'callback' mode. If the env var `PASSWORDLESS_LOGIN_CALLBACK_URI` is set, it will override the config value.
71+
// callbackURI:
72+
// process.env.PASSWORDLESS_LOGIN_CALLBACK_URI || '/passwordless-login-callback',
7273
// The landing path for passwordless login
7374
landingPath: '/passwordless-login-landing'
7475
},

0 commit comments

Comments
 (0)