summaryrefslogtreecommitdiff
path: root/graphs/js/oidc/redirect.js
blob: d063df3637390a664b0cee4f0dae35614bbc0c3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
const redirectBtn = document.getElementById("redirectBtn");

const authQueryParams = {
    client_id: "assistants-atelier-js",
    scope: "epita profile picture",
    redirect_uri: "http://localhost:8080/complete/epita/",
    response_type: "code",
};

const authEndpoint = "https://cri.epita.fr/authorize";
window.LOGIN_URL = new URL(
    `?client_id=${authQueryParams.client_id}&scope=${authQueryParams.scope}&redirect_uri=${authQueryParams.redirect_uri}&response_type=${authQueryParams.response_type}`,
    authEndpoint,
);
redirectBtn.addEventListener("click", () => {
    window.location.replace(window.LOGIN_URL);
});