forked from replayio-public/cypress-realworld-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.okta.tsx
50 lines (46 loc) · 1.21 KB
/
index.okta.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import React from "react";
import { createRoot } from "react-dom/client";
import { Router } from "react-router-dom";
import {
createTheme,
ThemeProvider,
Theme,
StyledEngineProvider,
adaptV4Theme,
} from "@mui/material";
// @ts-ignore
import { OktaAuth } from "@okta/okta-auth-js";
import { Security } from "@okta/okta-react";
import { history } from "./utils/historyUtils";
import AppOkta from "./containers/AppOkta";
const theme = createTheme(
adaptV4Theme({
palette: {
secondary: {
main: "#fff",
},
},
})
);
const root = createRoot(document.getElementById("root")!);
if (process.env.VITE_OKTA) {
const oktaAuth = new OktaAuth({
issuer: `https://${process.env.VITE_OKTA_DOMAIN}/oauth2/default`,
clientId: process.env.VITE_OKTA_CLIENTID,
redirectUri: window.location.origin + "/implicit/callback",
});
/* istanbul ignore next */
root.render(
<Router history={history}>
<StyledEngineProvider injectFirst>
<ThemeProvider theme={theme}>
<Security oktaAuth={oktaAuth}>
<AppOkta />
</Security>
</ThemeProvider>
</StyledEngineProvider>
</Router>
);
} else {
console.error("Okta is not configured.");
}