Skip to content

Commit ae979f7

Browse files
authored
Merge pull request #9 from elixir-europe/dev
ADD config OIDC
2 parents 7587452 + f7849c4 commit ae979f7

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

public/config/config-oidc.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"oidcUrl": "https://login.aai.lifescience-ri.eu/oidc/",
3+
"oidcClientId": "d3132b30-3a07-4a66-a065-512674fac86e"
4+
}

src/configLoader.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,12 @@ export async function loadConfig() {
44
throw new Error("Can not load config.json: " + res.status);
55
}
66
return res.json();
7+
}
8+
9+
export async function loadOIDCConfig() {
10+
const res = await fetch("/config/config-oidc.json", { cache: "no-store" });
11+
if (!res.ok) {
12+
throw new Error("Can not load config.json: " + res.status);
13+
}
14+
return res.json();
715
}

src/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
import { createRoot } from "react-dom/client";
22
import App from "./App";
33
import "./index.css";
4-
import { loadConfig } from "./configLoader";
4+
import { loadConfig, loadOIDCConfig } from "./configLoader";
55
import { AuthProvider } from "react-oidc-context";
66

77
(async () => {
88
const root = createRoot(document.getElementById('root'));
99
try {
1010
const cfg = await loadConfig();
11+
const OIDCCfg = await loadOIDCConfig();
1112

1213
window.CONFIG = cfg;
1314
globalThis.CONFIG = cfg;
1415

1516
console.log(process.env)
1617

1718
const oidcConfig = {
18-
authority: `${process.env.REACT_APP_BEACON_UI_OIDC_ENDPOINT}`,
19-
client_id: `${process.env.REACT_APP_BEACON_UI_OIDC_CLIENT_ID}`,
19+
authority: `${OIDCCfg.oidcUrl}`,
20+
client_id: `${OIDCCfg.oidcClientId}`,
2021
redirect_uri: `https://beacons.bsc.es/`,
2122
post_logout_redirect_uri: `https://beacons.bsc.es/`,
2223
response_type: "code",

0 commit comments

Comments
 (0)