Skip to content

Commit 44d2087

Browse files
amrutha95Amrutha Srinivasan
andauthored
801 fix (#818)
Co-authored-by: Amrutha Srinivasan <[email protected]>
1 parent da17933 commit 44d2087

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

samples/examples/simple-provider.html

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
<div class="container">
1111
<div class="leftContainer">
1212
<p id="WelcomeMessage">Welcome to the Microsoft Authentication Library For Javascript Quickstart</p>
13-
<button id="SignIn" onclick="signIn()">Sign In</button>
13+
<button id="SignIn">Sign In</button>
14+
<button id="SignOut" hidden>Sign Out</button>
1415
</div>
1516
<div class="rightContainer">
1617
<pre id="json"></pre>
@@ -50,6 +51,10 @@
5051
// Register Callbacks for redirect flow
5152
// myMSALObj.handleRedirectCallbacks(acquireTokenRedirectCallBack, acquireTokenErrorRedirectCallBack);
5253
myMSALObj.handleRedirectCallback(authRedirectCallBack);
54+
//Set login button
55+
var loginbutton = document.getElementById('SignIn');
56+
loginbutton.removeAttribute('hidden');
57+
loginbutton.addEventListener('click', signIn, true);
5358

5459
Providers.globalProvider = new SimpleProvider(async function(scopes) {
5560
var request = { scopes: scopes };
@@ -126,9 +131,13 @@
126131

127132
var divWelcome = document.getElementById('WelcomeMessage');
128133
divWelcome.innerHTML = 'Welcome ' + myMSALObj.getAccount().userName + ' to Microsoft Graph API';
134+
135+
//Toggle login and logout buttons
136+
var logoutbutton = document.getElementById('SignOut');
137+
logoutbutton.removeAttribute('hidden');
138+
logoutbutton.addEventListener('click', signOut, true);
129139
var loginbutton = document.getElementById('SignIn');
130-
loginbutton.innerHTML = 'Sign Out';
131-
loginbutton.setAttribute('onclick', 'signOut();');
140+
loginbutton.setAttribute('hidden', true);
132141
}
133142

134143
//This function can be removed if you do not need to support IE

0 commit comments

Comments
 (0)