Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/cradle77/Blazor.Msal

Sample implementation for MSAL in Blazor
https://github.com/cradle77/Blazor.Msal

Last synced: about 2 months ago
JSON representation

Sample implementation for MSAL in Blazor

Awesome Lists containing this project

README

        

# Des.Blazor.Authorization.Msal

[![Build Status](https://des.visualstudio.com/Blazor.Msal/_apis/build/status/Blazor.Msal-CI?branchName=master)](https://des.visualstudio.com/Blazor.Msal/_build/latest?definitionId=48&branchName=master)

![Nuget (with prereleases)](https://img.shields.io/nuget/vpre/Des.Blazor.Authorization.Msal)

> _.NET Core 3.1 Preview 3 supported_

This NuGet package adds support to Azure Active Directory to your Blazor Web Assembly application. It allows to authenticate the user and then acquire an access token to make a secure call to an external API:

![Diagram](https://github.com/cradle77/Blazor.Msal/blob/master/Diagram.png?raw=true)

The code internally uses [MSAL.js](https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-overview) to implement the *OpenID Connect* and *OAuth2* flows.

I'll be publishing a few articles on this topic. [*Follow me on twitter*](https://twitter.com/crad77?lang=en) if you are interested and want to be notified when they are out.

## How to use the package

### 1. Add the required references

The first step is to reference the NuGet package on the *Blazor Client* project:

```
Install-Package Des.Blazor.Authorization.Msal
```

Then we need to include MSAL.js in *index.html* page, before the reference to blazor.webassembly.js. This could either be a static file we include to our project, or just a link pointing to a CDN URL:

```
...