@@ -61,7 +61,7 @@ const authCodeUrlParameters = {
61
61
} ;
62
62
63
63
const pca = new msal . PublicClientApplication ( publicClientConfig ) ;
64
- const msalCacheManager = pca . getCacheManager ( ) ;
64
+ const msalTokenCache = pca . getTokenCache ( ) ;
65
65
let accounts ;
66
66
67
67
/**
@@ -73,7 +73,7 @@ const app = express();
73
73
app . engine ( '.hbs' , exphbs ( { extname : '.hbs' } ) ) ;
74
74
app . set ( 'view engine' , '.hbs' ) ;
75
75
76
- /**
76
+ /**
77
77
* App Routes
78
78
*/
79
79
app . get ( '/' , ( req , res ) => {
@@ -102,7 +102,7 @@ app.get('/redirect', (req, res) => {
102
102
console . log ( "\nResponse: \n:" , response ) ;
103
103
const templateParams = { showLoginButton : false , username : response . account . username , profile : false } ;
104
104
res . render ( "graph" , templateParams ) ;
105
- return msalCacheManager . writeToPersistence ( ) ;
105
+ return msalTokenCache . writeToPersistence ( ) ;
106
106
} ) . catch ( ( error ) => {
107
107
console . log ( error ) ;
108
108
res . status ( 500 ) . send ( error ) ;
@@ -112,7 +112,7 @@ app.get('/redirect', (req, res) => {
112
112
// Initiates Acquire Token Silent flow
113
113
app . get ( '/graphCall' , ( req , res ) => {
114
114
// get Accounts
115
- accounts = msalCacheManager . getAllAccounts ( ) ;
115
+ accounts = msalTokenCache . getAllAccounts ( ) ;
116
116
console . log ( "Accounts: " , accounts ) ;
117
117
118
118
// Build silent request
@@ -130,13 +130,13 @@ app.get('/graphCall', (req, res) => {
130
130
// Call graph after successfully acquiring token
131
131
graph . callMSGraph ( graphConfig . graphMeEndpoint , response . accessToken , ( response , endpoint ) => {
132
132
// Successful silent request
133
- templateParams = {
134
- ...templateParams ,
133
+ templateParams = {
134
+ ...templateParams ,
135
135
username,
136
136
profile : JSON . stringify ( response , null , 4 )
137
137
} ;
138
- res . render ( "graph" , templateParams )
139
- return msalCacheManager . writeToPersistence ( ) ;
138
+ res . render ( "graph" , templateParams ) ;
139
+ return msalTokenCache . writeToPersistence ( ) ;
140
140
} ) ;
141
141
} )
142
142
. catch ( ( error ) => {
@@ -146,7 +146,7 @@ app.get('/graphCall', (req, res) => {
146
146
} ) ;
147
147
} ) ;
148
148
149
- msalCacheManager . readFromPersistence ( ) . then ( ( ) => {
149
+ msalTokenCache . readFromPersistence ( ) . then ( ( ) => {
150
150
app . listen ( SERVER_PORT , ( ) => console . log ( `Msal Node Auth Code Sample app listening on port ${ SERVER_PORT } !` ) ) ;
151
151
} ) ;
152
152
0 commit comments