-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: MGT login sample in React (#20)
* Added mgt-login-spfx sample * Updated sample folder name * Updated README * Update sample.json
- Loading branch information
Showing
30 changed files
with
32,061 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
|
||
# Dependency directories | ||
node_modules | ||
|
||
# Build generated files | ||
dist | ||
lib | ||
release | ||
solution | ||
temp | ||
*.sppkg | ||
.heft | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# OSX | ||
.DS_Store | ||
|
||
# Visual Studio files | ||
.ntvs_analysis.dat | ||
.vs | ||
bin | ||
obj | ||
|
||
# Resx Generated Code | ||
*.resx.ts | ||
|
||
# Styles Generated Code | ||
*.scss.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
!dist | ||
config | ||
|
||
gulpfile.js | ||
|
||
release | ||
src | ||
temp | ||
|
||
tsconfig.json | ||
tslint.json | ||
|
||
*.log | ||
|
||
.yo-rc.json | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v18.17.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Hosted workbench", | ||
"type": "msedge", | ||
"request": "launch", | ||
"url": "https://{tenantDomain}/_layouts/workbench.aspx", | ||
"webRoot": "${workspaceRoot}", | ||
"sourceMaps": true, | ||
"sourceMapPathOverrides": { | ||
"webpack:///.././src/*": "${webRoot}/src/*", | ||
"webpack:///../../../src/*": "${webRoot}/src/*", | ||
"webpack:///../../../../src/*": "${webRoot}/src/*", | ||
"webpack:///../../../../../src/*": "${webRoot}/src/*" | ||
}, | ||
"runtimeArgs": [ | ||
"--remote-debugging-port=9222", | ||
"-incognito" | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Place your settings in this file to overwrite default and user settings. | ||
{ | ||
// Configure glob patterns for excluding files and folders in the file explorer. | ||
"files.exclude": { | ||
"**/.git": true, | ||
"**/.DS_Store": true, | ||
"**/bower_components": true, | ||
"**/coverage": true, | ||
"**/jest-output": true, | ||
"**/lib-amd": true, | ||
"src/**/*.scss.ts": true | ||
}, | ||
"typescript.tsdk": ".\\node_modules\\typescript\\lib" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"@microsoft/generator-sharepoint": { | ||
"plusBeta": false, | ||
"isCreatingSolution": true, | ||
"nodeVersion": "18.17.1", | ||
"sdksVersions": { | ||
"@microsoft/microsoft-graph-client": "3.0.2", | ||
"@microsoft/teams-js": "2.12.0" | ||
}, | ||
"version": "1.18.2", | ||
"libraryName": "mgt-login-spfx", | ||
"libraryId": "86763da1-f3b1-4297-85d7-610e358316b4", | ||
"environment": "spo", | ||
"packageManager": "npm", | ||
"solutionName": "mgt-login-spfx", | ||
"solutionShortDescription": "mgt-login-spfx description", | ||
"skipFeatureDeployment": true, | ||
"isDomainIsolated": false, | ||
"componentType": "webpart" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# mgt-login-spfx | ||
|
||
## Summary | ||
|
||
This sample illustrates how to use the `Login` component from the Microsoft Graph Toolkit React package in a SharePoint Framework web part. | ||
|
||
![mgt-login-spfx](./assets/react-login-spfx.gif) | ||
|
||
## Used SharePoint Framework Version | ||
|
||
![version](https://img.shields.io/badge/version-1.18.2-green.svg) | ||
|
||
## Contributors | ||
|
||
Guido Zambarda ([@iamguidozam](https://x.com/iamguidozam)), PiaSys.com | ||
|
||
## Version history | ||
|
||
| Version | Date | Comments | | ||
| ------- | ---------------- | --------------- | | ||
| 1.0 | June 22, 2024 | 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 | ||
- Ensure that you are at the solution folder | ||
- in the command-line run: | ||
- **npm install** | ||
- **gulp serve** | ||
|
||
## Features | ||
|
||
This sample illustrates the following concepts on top of the SharePoint Framework: | ||
|
||
- Using the `Login` component from the Microsoft Graph Toolkit. | ||
- Using the Microsoft Graph Toolkit in a SharePoint Framework web part. | ||
|
||
## References | ||
|
||
- [Getting started with SharePoint Framework](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-developer-tenant) | ||
- [Use Microsoft Graph in your solution](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/using-microsoft-graph-apis) | ||
- [Microsoft Graph Toolkit with React](https://learn.microsoft.com/en-us/graph/toolkit/get-started/mgt-react) | ||
- [Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) - Guidance, tooling, samples and open-source controls for your Microsoft 365 development | ||
|
||
<img src="https://pnptelemetry.azurewebsites.net/mgt-samples/samples/app/react-login-spfx" /> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
[ | ||
{ | ||
"name": "pnp-mgt-samples-react-login-spfx", | ||
"source": "pnp", | ||
"title": "Using login control in SPFx with React", | ||
"shortDescription": "Using the mgt-login component in a SharePoint Framework web part with React", | ||
"url": "https://github.com/pnp/mgt-samples/tree/main/samples/app/react-login-spfx", | ||
"longDescription": [ | ||
"This sample demonstrates how to use the Microsoft Graph Toolkit login component in a SharePoint Framework web part with React." | ||
], | ||
"creationDateTime": "2024-06-22", | ||
"updateDateTime": "2024-06-22", | ||
"products": ["Microsoft Graph", "Microsoft Graph Toolkit"], | ||
"metadata": [ | ||
{ | ||
"key": "MGT-COMPONENT", | ||
"value": "mgt-login" | ||
}, | ||
{ | ||
"key": "SPFX-VERSION", | ||
"value": "1.18.2" | ||
}, | ||
{ | ||
"key": "CLIENT-SIDE-DEV", | ||
"value": "React" | ||
} | ||
], | ||
"thumbnails": [ | ||
{ | ||
"type": "image", | ||
"order": 100, | ||
"url": "https://github.com/pnp/mgt-samples/blob/main/samples/app/react-login-spfx/assets/react-login-spfx.gif", | ||
"alt": "Preview" | ||
} | ||
], | ||
"authors": [ | ||
{ | ||
"gitHubAccount": "guidozam", | ||
"pictureUrl": "https://github.com/guidozam.png", | ||
"name": "Guido Zambarda" | ||
} | ||
], | ||
"references": [ | ||
{ | ||
"name": "Getting started with the Microsoft Graph Toolkit in React", | ||
"description": "The Microsoft Graph Toolkit components can easily be added to your web application, SharePoint web part, or Microsoft Teams tabs.", | ||
"url": "https://learn.microsoft.com/en-us/graph/toolkit/get-started/mgt-react" | ||
} | ||
] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/config.2.0.schema.json", | ||
"version": "2.0", | ||
"bundles": { | ||
"mgt-login-web-part": { | ||
"components": [ | ||
{ | ||
"entrypoint": "./lib/webparts/mgtLogin/MgtLoginWebPart.js", | ||
"manifest": "./src/webparts/mgtLogin/MgtLoginWebPart.manifest.json" | ||
} | ||
] | ||
} | ||
}, | ||
"externals": {}, | ||
"localizedResources": { | ||
"MgtLoginWebPartStrings": "lib/webparts/mgtLogin/loc/{locale}.js" | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
samples/app/react-login-spfx/config/deploy-azure-storage.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/deploy-azure-storage.schema.json", | ||
"workingDir": "./release/assets/", | ||
"account": "<!-- STORAGE ACCOUNT NAME -->", | ||
"container": "mgt-login-spfx", | ||
"accessKey": "<!-- ACCESS KEY -->" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json", | ||
"solution": { | ||
"name": "mgt-login-spfx-client-side-solution", | ||
"id": "86763da1-f3b1-4297-85d7-610e358316b4", | ||
"version": "1.0.0.0", | ||
"includeClientSideAssets": true, | ||
"skipFeatureDeployment": true, | ||
"isDomainIsolated": false, | ||
"developer": { | ||
"name": "", | ||
"websiteUrl": "", | ||
"privacyUrl": "", | ||
"termsOfUseUrl": "", | ||
"mpnId": "Undefined-1.18.2" | ||
}, | ||
"metadata": { | ||
"shortDescription": { | ||
"default": "mgt-login-spfx description" | ||
}, | ||
"longDescription": { | ||
"default": "mgt-login-spfx description" | ||
}, | ||
"screenshotPaths": [], | ||
"videoUrl": "", | ||
"categories": [] | ||
}, | ||
"features": [ | ||
{ | ||
"title": "mgt-login-spfx Feature", | ||
"description": "The feature that activates elements of the mgt-login-spfx solution.", | ||
"id": "d8678a1a-380a-4771-9ffa-96f99508dedc", | ||
"version": "1.0.0.0" | ||
} | ||
] | ||
}, | ||
"paths": { | ||
"zippedPackage": "solution/mgt-login-spfx.sppkg" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"$schema": "https://developer.microsoft.com/json-schemas/core-build/sass.schema.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/spfx-serve.schema.json", | ||
"port": 4321, | ||
"https": true, | ||
"initialPage": "https://{tenantDomain}/_layouts/workbench.aspx" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/write-manifests.schema.json", | ||
"cdnBasePath": "<!-- PATH TO CDN -->" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
'use strict'; | ||
|
||
const build = require('@microsoft/sp-build-web'); | ||
|
||
build.addSuppression(`Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.`); | ||
|
||
var getTasks = build.rig.getTasks; | ||
build.rig.getTasks = function () { | ||
var result = getTasks.call(build.rig); | ||
|
||
result.set('serve', result.get('serve-deprecated')); | ||
|
||
return result; | ||
}; | ||
|
||
build.initialize(require('gulp')); |
Oops, something went wrong.