@mo-platform/auth
Version:
Mo authentication library
31 lines (24 loc) • 726 B
HTML
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>SignIn Demo</title>
<script type="text/javascript" src="dist/moauth.bundle.js"></script>
</head>
<body>
<div id="welcome">
<a href="#" id="login" onclick="auth.authorize({'redirectUrl': window.location})">Sign In with e-portal</a>
</div>
<script type="text/javascript">
var auth = new moauth();
auth
.checkToken()
.then( function(user) {
console.log(user);
var container = document.getElementById("welcome")
container.innerHTML = "Welcome, " + user.displayName + " (" + user.eportal.Role +")";
container.innerHTML += " <a href='#' onclick='auth.logout()'>Logout</a>";
});
</script>
</body>
</html>