This repo contains a sample single page application (SPA) that shows how to use the Microsoft Graph to get the profile of the current user from Microsoft 365.
The app is built in two ways: using an immediately invoked function expression (IIFE) and using ES modules.
- Node.js LTS
- Microsoft 365 developer tenant, you can get it for free through the Microsoft 365 developer program
- Clone the repo
- Change the working directory to the repo folder
- Start terminal, change the working directory to the repo folder and run:
chmod +x setup.sh
- Run the setup script:
./setup.sh
- Start the development server:
npx lite-server
- In your web browser open
http://localhost:3000/index.html
orhttp://localhost:3000/index_esm.html
- Retrieving the Microsoft 365 profile of the current user with the Microsoft Graph JS SDK
- Facilitate authentication and authorization using MSAL.js
- Signing in users with the MSAL.js redirect flow
- Registering a new Azure AD application for a single page app using CLI for Microsoft 365