|
3 | 3 | <head> |
4 | 4 | <title>Quickstart for MSAL JS</title> |
5 | 5 | <script src="https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js"></script> |
6 | | - <script src="/msal-1.0.0-preview.5.min.js"></script> |
| 6 | + <script src="/msal-1.0.0-preview.4.min.js"></script> |
7 | 7 | </head> |
8 | 8 |
|
9 | 9 | <body> |
|
19 | 19 | <script> |
20 | 20 | var msalConfig = { |
21 | 21 | auth: { |
22 | | - clientId: '90e4bba5-5f7f-4f13-88b1-369a72041df2', //This is your client ID |
23 | | - authority: "https://login.microsoftonline.com/328d6c53-e6b9-4ea5-ad0f-bf95c9a0c6af" //This is your tenant info |
| 22 | + clientId: 'Enter_the_Application_Id_here', //This is your client ID |
| 23 | + authority: "https://login.microsoftonline.com/Enter_the_Tenant_Info_Here" //This is your tenant info |
24 | 24 | }, |
25 | 25 | cache: { |
26 | 26 | cacheLocation: "localStorage", |
|
41 | 41 | var myMSALObj = new Msal.UserAgentApplication(msalConfig); |
42 | 42 |
|
43 | 43 | // Register Callbacks for redirect flow |
44 | | - // myMSALObj.handleRedirectCallback(authRedirectCallBack); |
| 44 | + myMSALObj.handleRedirectCallbacks(acquireTokenRedirectCallBack, acquireTokenErrorRedirectCallBack); |
45 | 45 |
|
46 | 46 | function signIn() { |
47 | 47 | myMSALObj.loginPopup(requestObj).then(function (loginResponse) { |
|
115 | 115 | }); |
116 | 116 | } |
117 | 117 |
|
118 | | - function authRedirectCallBack(error, response) { |
119 | | - if (error) { |
120 | | - console.log(error); |
| 118 | + function acquireTokenRedirectCallBack(response) { |
| 119 | + if (response.tokenType === "access_token") { |
| 120 | + callMSGraph(graphConfig.graphMeEndpoint, response.accessToken, graphAPICallback); |
121 | 121 | } else { |
122 | | - if (response.tokenType === "access_token") { |
123 | | - callMSGraph(graphConfig.graphMeEndpoint, response.accessToken, graphAPICallback); |
124 | | - } else { |
125 | | - console.log("token type is:" + response.tokenType); |
126 | | - } |
| 122 | + console.log("token type is:" + response.tokenType); |
127 | 123 | } |
128 | 124 | } |
129 | 125 |
|
| 126 | + function acquireTokenErrorRedirectCallBack(error) { |
| 127 | + console.log(error); |
| 128 | + } |
| 129 | + |
130 | 130 | function requiresInteraction(errorCode) { |
131 | 131 | if (!errorCode || !errorCode.length) { |
132 | 132 | return false; |
|
0 commit comments