Skip to content

Commit 8c7743a

Browse files
authored
Merge pull request #204799 from derisen/patch-4
Add link to the msal-node migration sample
2 parents cb479a2 + ab30819 commit 8c7743a

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

articles/active-directory/develop/msal-node-migration.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ ms.custom: has-adal-ref
2121

2222
## Prerequisites
2323

24-
- Node version 10, 12 or 14. See the [note on version support](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-node#node-version-support)
24+
- Node version 10, 12, 14, 16 or 18. See the [note on version support](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-node#node-version-support)
2525

2626
## Update app registration settings
2727

@@ -373,16 +373,19 @@ const cca = new msal.ConfidentialClientApplication(config);
373373

374374
const refreshTokenRequest = {
375375
refreshToken: "", // your previous refresh token here
376-
scopes: ["user.read"],
376+
scopes: ["https://graph.microsoft.com/.default"],
377+
forceCache: true,
377378
};
378379

379380
cca.acquireTokenByRefreshToken(refreshTokenRequest).then((response) => {
380-
console.log(JSON.stringify(response));
381+
console.log(response);
381382
}).catch((error) => {
382-
console.log(JSON.stringify(error));
383+
console.log(error);
383384
});
384385
```
385386

387+
For more information, please refer to the [ADAL Node to MSAL Node migration sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-node-samples/refresh-token).
388+
386389
> [!NOTE]
387390
> We recommend you to destroy the older ADAL Node token cache once you utilize the still valid refresh tokens to get a new set of tokens using the MSAL Node's `acquireTokenByRefreshToken` method as shown above.
388391
@@ -419,7 +422,7 @@ var adal = require('adal-node');
419422
// Authentication parameters
420423
var clientId = 'Enter_the_Application_Id_Here';
421424
var clientSecret = 'Enter_the_Client_Secret_Here';
422-
var tenant = 'common';
425+
var tenant = 'Enter_the_Tenant_Info_Here';
423426
var authorityUrl = 'https://login.microsoftonline.com/' + tenant;
424427
var redirectUri = 'http://localhost:3000/redirect';
425428
var resource = 'https://graph.microsoft.com';
@@ -501,7 +504,7 @@ const msal = require('@azure/msal-node');
501504
const config = {
502505
auth: {
503506
clientId: "Enter_the_Application_Id_Here",
504-
authority: "https://login.microsoftonline.com/common",
507+
authority: "https://login.microsoftonline.com/Enter_the_Tenant_Info_Here",
505508
clientSecret: "Enter_the_Client_Secret_Here"
506509
},
507510
system: {

0 commit comments

Comments
 (0)