Skip to content

Commit

Permalink
move the auth configuration to index.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
karla-vm committed Dec 7, 2023
1 parent 8d4b6f2 commit f4c0cd8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
14 changes: 14 additions & 0 deletions services/ui-src/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ Amplify.configure({
bucket: config.s3.BUCKET,
identityPoolId: config.cognito.IDENTITY_POOL_ID,
},
Auth: {
mandatorySignIn: true,
region: config.cognito.REGION,
userPoolId: config.cognito.USER_POOL_ID,
identityPoolId: config.cognito.IDENTITY_POOL_ID,
userPoolWebClientId: config.cognito.APP_CLIENT_ID,
oauth: {
domain: config.cognito.APP_CLIENT_DOMAIN,
redirectSignIn: config.cognito.REDIRECT_SIGNIN,
redirectSignOut: config.cognito.REDIRECT_SIGNOUT,
scope: ["email", "openid", "profile"],
responseType: "code",
},
},
});

// LaunchDarkly configuration
Expand Down
18 changes: 0 additions & 18 deletions services/ui-src/src/utils/auth/UserProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,24 +107,6 @@ export const UserProvider = ({ children }: Props) => {
}
}, [isProduction, location]);

// single run configuration
useEffect(() => {
Auth.configure({
mandatorySignIn: true,
region: config.cognito.REGION,
userPoolId: config.cognito.USER_POOL_ID,
identityPoolId: config.cognito.IDENTITY_POOL_ID,
userPoolWebClientId: config.cognito.APP_CLIENT_ID,
oauth: {
domain: config.cognito.APP_CLIENT_DOMAIN,
redirectSignIn: config.cognito.REDIRECT_SIGNIN,
redirectSignOut: config.cognito.REDIRECT_SIGNOUT,
scope: ["email", "openid", "profile"],
responseType: "code",
},
});
}, []);

// rerender on auth state change, checking router location
useEffect(() => {
checkAuthState();
Expand Down

0 comments on commit f4c0cd8

Please sign in to comment.