Newer
Older
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>SIB-OIDC test</title>
<script type="module" src="./dist/index.js"></script>
padding: 0.5rem;
margin-bottom: 1rem;
<div id="result"></div>
<div bind-user class="bu-test">user-id:</div>
<button id="login">Se connecter</button>
<button id="logout">Se déconnecter</button>
data-authority="https://api.test3.startinblox.com"
const sibAuth = document.querySelector("sib-auth")
login.onclick = () => sibAuth.login()
logout.onclick = () => sibAuth.logout()
document.addEventListener("DOMContentLoaded", () => {
sibAuth.getUser().then(user => {
result.innerHTML = !user
? `Vous n'êtes pas connecté !`
: `User Web-Id: <pre>${user["@id"]}</pre>`
});
})