The Microsoft Graph Toolkit (MGT) is a collection of reusable, framework-agnostic components and authentication providers for accessing and working with Microsoft Graph. The components are fully functional right out of the box, with built in providers that authenticate with and fetch data from Microsoft Graph.
MGT has a nice and simple integration with SharePoint Framework with just one line of code:
Providers.globalProvider = new SharePointProvider(this.context);
However, MGT supports other provider types as well. Like Proxy provider. In some cases, it makes sense to use the Proxy provider inside your SharePoint Framework solution instead of the SharePointProvider. Here is why:
- you have a backend API that talks to MS Graph with on-behalf-of (OBO) flow. You don't use JS code to talk to MS Graph and rely solely on the backend
- you don't want to maintain many "webApiPermissionRequests" entries inside package-solution.json, because every new permission requires re-deployment
If the above is true for you, then you can implement the Proxy provider for MGT instead of SharePointProvider.
The source code for this sample is available at GitHub here.