Skip to content

Example application for connecting to Graph API from Blazor

License

Notifications You must be signed in to change notification settings

jburman/BlazorGraphExample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

BlazorGraphExample demonstrates a self contained Blazor application that connects to Microsoft's Graph API, queries the user's information and lets them browse through their OneDrive. There is not any server side code and you can try a demo hosted in an Azure Static Web site.

Example

Authentication calls are handled by the AuthService, which provides a thin wrapper over the MSAL.js library that is designed for SPA applications. Once a token is acquired through MSAL, all of the Graph API calls are made from the GraphService using a few hand coded classes. (Note: In the latest release of this sample, the Graph API Service code has now been moved out to a separate NuGet package to make it reusable.)

To try the sample out yourself:

  • Clone the repository
  • Register a new app with Microsoft. Be sure to select Web Platform and check Allow Implicit Flow.
  • Fill in the Redirect URI (the project uses https://localhost:44395/ by default)
  • Copy the Client ID and update Startup.cs to use it.

You can now either run the project from Visual Studio using IISExpress or with something like dotnet-serve.

Run with dotnet-serve

  1. From the folder with the BlazorGraphExample.sln file run a dotnet publish. Example: dotnet publish -o c:\publish
  2. Change to the dist folder (for example: c:\publish\BlazorGraphExample\dist)
  3. Launch the index.html: dotnet-serve -S -p 44395 -o

About

Example application for connecting to Graph API from Blazor

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published