Skip to content

Commit

Permalink
Change the method of obtaining tokens from implicit flow to pkce (#17530
Browse files Browse the repository at this point in the history
)

* Upgrade msal.js to a higher version to use PKCE.
  • Loading branch information
zhichengliu12581 authored Nov 13, 2020
1 parent 829ca05 commit 65b9871
Show file tree
Hide file tree
Showing 6 changed files with 9,079 additions and 8,357 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,40 @@ angular.module('todoApp', ['ngRoute', 'MsalAngular'])

msalProvider.init(
{
authority: 'https://login.microsoftonline.com/xxxorg.onmicrosoft.com',
clientID: applicationConfig.clientID,
cacheLocation: 'localStorage',
postLogoutRedirectUri: 'http://localhost:8080/logout',

tokenReceivedCallback: function (errorDesc, token, error, tokenType) {
auth: {
clientId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
authority: "https://login.microsoftonline.com/xxxorg.onmicrosoft.com",
redirectUri: "http://localhost:8080/",
},
cache: {
cacheLocation: "sessionStorage", // This configures where your cache will be stored
storeAuthStateInCookie: false, // Set this to "true" if you are having issues on IE11 or Edge
},
},
system: {
loggerOptions: {
loggerCallback: (level, message, containsPii) => {
if (containsPii) {
return;
}
switch (level) {
case msal.LogLevel.Error:
console.error(message);
return;
case msal.LogLevel.Info:
console.info(message);
return;
case msal.LogLevel.Verbose:
console.debug(message);
return;
case msal.LogLevel.Warning:
console.warn(message);
return;
}
}
}
}
}
,
$httpProvider
);

}]);
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
angular.module('todoApp')
.controller('homeCtrl', ['$scope', 'msalAuthenticationService', '$location', function ($scope, msalService, $location) {
$scope.login = function () {
msalService.loginRedirect();
msalService.loginRedirect({
scopes: ["User.Read"]
});
};
$scope.logout = function () {
msalService.logout();
};
$scope.isActive = function (viewLocation) {
return viewLocation === $location.path();
};
}]);
}]);
Loading

0 comments on commit 65b9871

Please sign in to comment.