Skip to content

Commit

Permalink
Add mashupGrantType of "none" for custom authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
tumms2021389 committed Nov 4, 2024
1 parent d23ec64 commit 6dc9da2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/react-sdk-components/src/samples/Embedded/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`;
Expand All @@ -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(() => {
Expand Down

0 comments on commit 6dc9da2

Please sign in to comment.