@@ -20,7 +20,6 @@
|
||||
"@tailwindcss/vite": "^4.1.13",
|
||||
"@tanstack/react-table": "^8.21.3",
|
||||
"axios": "^1.7.2",
|
||||
"daisyui": "^5.1.10",
|
||||
"dotenv": "^16.4.7",
|
||||
"framer-motion": "^12.23.24",
|
||||
"leaflet": "^1.9.4",
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import { createReactOidc } from "oidc-spa/react";
|
||||
|
||||
export const { OidcProvider, useOidc, getOidc } = createReactOidc(async () => ({
|
||||
issuerUri: `https://login.microsoftonline.com/${import.meta.env.VITE_TENANT_ID}/v2.0`,
|
||||
issuerUri: import.meta.env.VITE_ISSUER_URI,
|
||||
clientId: import.meta.env.VITE_CLIENT_ID,
|
||||
homeUrl: import.meta.env.VITE_BASE_URL,
|
||||
scopes: ['email', 'openid', 'profile', `api://${import.meta.env.VITE_CLIENT_ID}/user_impersonation`],
|
||||
autoLogin: false,
|
||||
postLoginRedirectUrl: '/',
|
||||
noIframe: true
|
||||
noIframe: true,
|
||||
extraQueryParams: {
|
||||
audience: "api://flying-test-api"
|
||||
}
|
||||
}));
|
||||
@@ -8,7 +8,8 @@ export const useUserRole = () => {
|
||||
|
||||
useEffect(() => {
|
||||
if (isUserLoggedIn && decodedIdToken) {
|
||||
const idTokenRoles: string[] = decodedIdToken!.roles as string[];
|
||||
const rolesKeyName: string | undefined = Object.keys(decodedIdToken).find((key) => key.includes('roles'));
|
||||
const idTokenRoles: string[] = decodedIdToken[rolesKeyName!] as string[];
|
||||
|
||||
let newUserRole: string | undefined;
|
||||
|
||||
|
||||
1
client/src/vite-env.d.ts
vendored
1
client/src/vite-env.d.ts
vendored
@@ -3,6 +3,7 @@
|
||||
interface ImportMetaEnv {
|
||||
readonly VITE_BASE_URL: string;
|
||||
readonly VITE_CLIENT_ID: string;
|
||||
readonly VITE_ISSUER_URI: string;
|
||||
readonly VITE_TENANT_ID: string;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user