https://github.com/mmsharepoint/react-site-secure-function-call-smpl
https://github.com/mmsharepoint/react-site-secure-function-call-smpl
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mmsharepoint/react-site-secure-function-call-smpl
- Owner: mmsharepoint
- Created: 2024-06-17T07:33:26.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-13T07:59:17.000Z (almost 2 years ago)
- Last Synced: 2025-01-14T08:16:31.740Z (over 1 year ago)
- Language: JavaScript
- Size: 325 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# react-site-secure-function-call-smpl
## Summary
This combined SharpPoint Framework and Azure Function solution is to provide the potentially most secure access from SharePoint Famework to any kind of third party API, in fact here Microsoft Graph. It shows that AadHttpClient should be preferred over MSGraphClient.
|Update site descreption|
:-------------------------:

For further details see the author's [blog post](https://mmsharepoint.wordpress.com/2024/06/18/calling-microsoft-graph-in-spfx-the-secure-way/SS)
## Used SharePoint Framework Version

## Applies to
- [SharePoint Framework](https://aka.ms/spfx)
- [Microsoft 365 tenant](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-developer-tenant)
- [AzureFunctions .Net8 *LTS]()
## Prerequisites
> Any special pre-requisites?
## Version history
Version|Date|Author|Comments
-------|----|--------|--------
1.0|June 31, 2024|[Markus Moeller](http://www.twitter.com/moeller2_0)|Initial release
## Disclaimer
**THIS CODE IS PROVIDED _AS IS_ WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**
---
## Minimal Path to Awesome
- Clone this repository
```bash
git clone https://github.com/mmsharepoint/react-site-secure-function-call-smpl.git
```
- You will need to register an app in Entra ID
- with client secret
- with **delegated** Graph permission Sites.FullControl.All
- With exposed Api "access_as_user" and App ID Uri api://[Your-Desired-Func-Url]/[Your-ClienID]
- Azure Function:
- Rename local.sample.settings.json to local.settings.json and fill out tenantId, clientId, clientSecret and domain [Your-Desired-Func-Url]
- Run F5
- SPFx web part
- Rename azFunct.sample.json to azFunct.json and fill out appIdUri api://[Your-Desired-Func-Url]/[Your-ClienID]
- Ensure that you are at the solution folder
- in the command-line run:
- **npm install**
- **gulp serve**
> Include any additional steps as needed.
## Features
Description of the extension that expands upon high-level summary above.
This extension illustrates the following concepts:
- [Consume multi-tenant enterprise APIs secured with Azure AD in SharePoint Framework](https://learn.microsoft.com/en-us/sharepoint/dev/spfx/use-aadhttpclient-enterpriseapi-multitenant?WT.mc_id=M365-MVP-5004617)
## References
- [Getting started with SharePoint Framework](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-developer-tenant)
- [Building for Microsoft teams](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/build-for-teams-overview)
- [Use Microsoft Graph in your solution](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/using-microsoft-graph-apis?WT.mc_id=M365-MVP-5004617)
- [Publish SharePoint Framework applications to the Marketplace](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/publish-to-marketplace-overview)
- [Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) - Guidance, tooling, samples and open-source controls for your Microsoft 365 development