-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage2.html
66 lines (60 loc) · 2.05 KB
/
page2.html
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!DOCTYPE html>
<html>
<head>
<title>Second Page</title>
<script src="https://alcdn.msauth.net/browser/2.13.1/js/msal-browser.min.js"></script>
<style>
.menu {
display: flex;
justify-content: space-around;
background-color: #f0f0f0;
padding: 10px;
}
.full-width-image {
width: 100%;
}
.banner {
height: 200px;
width: 100%;
background-color: #c0c0c0;
}
</style>
</head>
<body>
<div class="menu">
<button>Button 1</button>
<button>Button 2</button>
<button>Button 3</button>
<button>Button 4</button>
<button>Button 5</button>
</div>
<img src="your-image-url" class="full-width-image" alt="Full screen image">
<div class="banner"></div>
<script>
const msalConfig = {
auth: {
clientId: '4e33a7bf-6b73-4038-8eee-d411867a951c', // this is the Application (client) ID of your registered Azure application
authority: 'https://login.microsoftonline.com/0c86cb28-8440-4de3-837a-3d05a1725da1', // replace 'your-tenant-id' with your Azure AD tenant ID
redirectUri: '<a href="page2.html">Page 2</a>',
},
cache: {
cacheLocation: "sessionStorage",
storeAuthStateInCookie: false,
}
};
const myMSALObj = new msal.PublicClientApplication(msalConfig);
function handleResponse(resp) {
if (resp !== null) {
var accountObj = myMSALObj.getAccountByUsername(resp.account.username);
var claims = resp.idTokenClaims;
sessionStorage.setItem('given_name', claims.given_name);
sessionStorage.setItem('email', claims.email);
// and other code to update the page
}
}
myMSALObj.handleRedirectPromise().then(handleResponse).catch(function (error) {
console.log(error);
});
</script>
</body>
</html>