Skip to content

Commit

Permalink
feat: support optional configuration for login with local dev account
Browse files Browse the repository at this point in the history
  • Loading branch information
csm-thu committed Jul 29, 2024
1 parent 8efbcd3 commit 4c6638d
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/services/config/Auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,21 @@ const MSAL_CONFIG = {
},
};

// Optional config for local fake dev account (can't be used to retrieve a valid token)
const AUTH_DEV_CONFIG = {
// accountId: 'xxxxxxxx-xxxx-dave-xxxx-xxxxxxxxxxxx',
// userEmail: 'dev.sample.webapp@example.com',
// userId: 'xxxxxxxx-xxxx-dave-xxxx-xxxxxxxxxxxx',
// userName: 'Dave Lauper',
// roles: ['Organization.User'],
};

if (process.env.REACT_APP_AUTH_DEV_ACCOUNT_ID) AUTH_DEV_CONFIG.accountId = process.env.REACT_APP_AUTH_DEV_ACCOUNT_ID;
if (process.env.REACT_APP_AUTH_DEV_USER_EMAIL) AUTH_DEV_CONFIG.userEmail = process.env.REACT_APP_AUTH_DEV_USER_EMAIL;
if (process.env.REACT_APP_AUTH_DEV_USER_ID) AUTH_DEV_CONFIG.userId = process.env.REACT_APP_AUTH_DEV_USER_ID;
if (process.env.REACT_APP_AUTH_DEV_USER_NAME) AUTH_DEV_CONFIG.userName = process.env.REACT_APP_AUTH_DEV_USER_NAME;
if (process.env.REACT_APP_AUTH_DEV_ROLE) AUTH_DEV_CONFIG.roles = [process.env.REACT_APP_AUTH_DEV_ROLE];

// Register the providers used in the application
Auth.addProvider(AuthDev);
Auth.addProvider(AuthDev).setConfig(AUTH_DEV_CONFIG);
Auth.addProvider(AuthMSAL).setConfig(MSAL_CONFIG);

0 comments on commit 4c6638d

Please sign in to comment.