Last blogpost showed how to use the MS Graph Toolkit for getting info from the graph, and show them in a SPFX webpart, without the need for writing all the data-fetching and UI code.
Using the toolkit directly in HTML is also super-easy. The setup is a bit different, because now we need to register the app in AAD.
Let's try to achieve the same result as what we had with SPFX. Let's get to AAD and register the app. I register the app as an SPA, with following setup:
I also need Read-write permissions for Tasks:
The component used is again mgt-todo, but we need two additional things: a component for loging in (equally simple to add), and a provider for the authentication using MSAL.
The client-id used for the provider is, obviously, the id you got when registering the app in AAD. The authority refers to your Tenant. The last on can be skipped if you register the app as multitenant.
Again, that's it. It's working in like 5' !! Let's go home early today...