You have to register an application in Azure Active Directory in order to run this application. You could do it manually in the Azure Portal.
- Register a new application in the Azure Portal.
- Ensure that the application is enabled for the authorization code flow with PKCE. This will require that you redirect URI configured in the portal is of type SPA.
- For this sample we will create a single tenant application
- Copy the value of the
Application (client) ID
of the newly registered application from Azure Portal. You can get this from the overview page of the newly registered application. - In the
auth.js
file, on line 4, replace the value of theclientId
property with the copiedApplication (client) ID
- Copying the value of the
Directory (tenant) ID
of the newly registered application from Azure Portal. You can get this from the overview page of the newly registered application. - In the
auth.js
file, on line 6, replace the value of theauthority
property with theDirectory (tenant) ID
copied in above step, eghttps://login.microsoftonline.com/0be187e2-aa5c-464a-bc8b-74b0416b4c3a
, since this is a single tenant application. - In case you created a multi-tenant application then comment out line 6 in
auth.js
. You don't need to pass the authority.
- In the command line, go to the project root folder mslearn-retrieve-m365-data-with-msgraph-quickstart.
- Run below script in the command line. This will open your application in the browser with the url http://localhost:8080.
npm start
If the configuration of the app is successful, the app will be as shown below: