Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@W-17263304 Passwordless login with marketing cloud #2131

Open
wants to merge 44 commits into
base: feature-passwordless-social-login
Choose a base branch
from

Conversation

bredmond-sf
Copy link
Collaborator

@bredmond-sf bredmond-sf commented Nov 13, 2024

Description

This both supports passwordless login within the retail react app UI and adds callback endpoints to ssr.js for customers to connect it with Marketing Cloud.

Types of Changes

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Documentation update
  • Breaking change (could cause existing functionality to not work as expected)
  • Other changes (non-breaking changes that does not fit any of the above)

Breaking changes include:

  • Removing a public function or component or prop
  • Adding a required argument to a function
  • Changing the data type of a function parameter or return value
  • Adding a new peer dependency to package.json

Changes

  • (change1)

How to Test-Drive This PR

Merge Basket with Passwordless Login

  • Add item to the cart as a guest user
  • Login via passwordless login
  • Click the email link
  • Verify the items added while as a guest are in the cart after login

Checklists

General

  • Changes are covered by test cases
  • CHANGELOG.md updated with a short description of changes (not required for documentation updates)

Accessibility Compliance

You must check off all items in one of the follow two lists:

  • There are no changes to UI

or...

Localization

  • Changes include a UI text update in the Retail React App (which requires translation)

@bredmond-sf bredmond-sf changed the base branch from develop to feature-passwordless-social-login November 13, 2024 16:11
import {isServer} from '@salesforce/retail-react-app/app/utils/utils'
import {getConfig} from '@salesforce/pwa-kit-runtime/utils/ssr-config'

const LOGIN_ERROR_MESSAGE = defineMessage({
defaultMessage: 'Incorrect username or password, please try again.',
id: 'login_page.error.incorrect_username_or_password'
})
const INVALID_TOKEN_ERROR_MESSAGE = defineMessage({
defaultMessage: 'Invalid token, please try again.',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Invalid and expired tokens both return a 401 so I've made the error message as above. But we could reword it to be "Token has expired".
Screenshot 2024-11-19 at 2 46 34 PM

@@ -1096,8 +1097,9 @@ class Auth {
},
{
...(callbackURI && {callbackURI: callbackURI}),
...(usid && {usid}),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sending usid as part of the authorizePasswordless API call in an attempt to make the merge basket work

@@ -163,6 +164,8 @@ const CommerceApiProvider = (props: CommerceApiProviderProps): ReactElement => {
clientSecret,
silenceWarnings,
configLogger,
defaultDnt,
callbackURI,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was needed so that the callbackURI could be picked up automatically

@@ -68,7 +68,7 @@ const AppConfig = ({children, locals = {}}) => {
headers={headers}
// Uncomment 'enablePWAKitPrivateClient' to use SLAS private client login flows.
// Make sure to also enable useSLASPrivateClient in ssr.js when enabling this setting.
// enablePWAKitPrivateClient={true}
enablePWAKitPrivateClient={true}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably want to revert this before we merge but leaving it now for testing purposes

@bredmond-sf bredmond-sf changed the title @W-17093012 passwordless poc mc @W-17263304 Passwordless login with marketing cloud Nov 25, 2024
@bredmond-sf bredmond-sf marked this pull request as ready for review November 25, 2024 13:56
@bredmond-sf bredmond-sf requested a review from a team as a code owner November 25, 2024 13:56
import express from 'express'
import {emailLink} from './marketing-cloud-email-link'

const ENABLE_SSR_POST = (process.env.ENABLE_SSR_POST || "").toLowerCase() === "true"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at this feature flag it's not immediately clear what this does, maybe we can rename to ENABLE_PASSWORDLESS_LOGIN, ENABLE_MARKETING_CLOUD_PASSWORDLESS, or something along those lines?

@@ -0,0 +1,105 @@
/*
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's put these under the util folder or create a new directory for these like marketing-cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants