From 6dc9da2251068a848b8776a8b25f6122b858a55d Mon Sep 17 00:00:00 2001 From: Siva Rama Krishna Date: Mon, 4 Nov 2024 17:10:47 +0530 Subject: [PATCH] Add mashupGrantType of "none" for custom authentication --- packages/react-sdk-components/src/samples/Embedded/utils.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/react-sdk-components/src/samples/Embedded/utils.ts b/packages/react-sdk-components/src/samples/Embedded/utils.ts index 752d5189..89181c7f 100644 --- a/packages/react-sdk-components/src/samples/Embedded/utils.ts +++ b/packages/react-sdk-components/src/samples/Embedded/utils.ts @@ -34,13 +34,13 @@ export const shoppingOptions = [ ]; export function initializeAuthentication(sdkConfigAuth) { - if (!sdkConfigAuth.mashupClientId && sdkConfigAuth.customAuthType === 'Basic') { + if ((sdkConfigAuth.mashupGrantType === 'none' || !sdkConfigAuth.mashupClientId) && sdkConfigAuth.customAuthType === 'Basic') { // Service package to use custom auth with Basic const sB64 = window.btoa(`${sdkConfigAuth.mashupUserIdentifier}:${window.atob(sdkConfigAuth.mashupPassword)}`); sdkSetAuthHeader(`Basic ${sB64}`); } - if (!sdkConfigAuth.mashupClientId && sdkConfigAuth.customAuthType === 'BasicTO') { + if ((sdkConfigAuth.mashupGrantType === 'none' || !sdkConfigAuth.mashupClientId) && sdkConfigAuth.customAuthType === 'BasicTO') { const now = new Date(); const expTime = new Date(now.getTime() + 5 * 60 * 1000); let sISOTime = `${expTime.toISOString().split('.')[0]}Z`; @@ -51,7 +51,7 @@ export function initializeAuthentication(sdkConfigAuth) { sdkSetAuthHeader(`Basic ${sB64}`); } - if (sdkConfigAuth.customAuthType === 'CustomIdentifier') { + if (sdkConfigAuth.mashupGrantType === 'customBearer' && sdkConfigAuth.customAuthType === 'CustomIdentifier') { // Use custom bearer with specific custom parameter to set the desired operator via // a userIdentifier property. (Caution: highly insecure...being used for simple demonstration) sdkSetCustomTokenParamsCB(() => {