Home > Net >  Differences between WebAssembly.Authentication and WebAssembly.Msal
Differences between WebAssembly.Authentication and WebAssembly.Msal

Time:04-21

I'm just getting acquainted with Azure authentication and I am already lost at the beginning.

I do not find what is the difference between Microsoft.AspNetCore.Components.WebAssembly.Authentication and Microsoft.Authentication.WebAssembly.Msal.

I can see that first is valid from version 6.0.3 and the last is from 6.0.4 but I do not know why the new one is better than the other and how can I use it.

Please don't give me minus - rather an answer.

Thank you in advance.

CodePudding user response:

Microsoft.AspNetCore.Components.WebAssembly.Authentication and Microsoft.Authentication.WebAssembly.Msal packages provide a set of primitives that help the application to authenticate users and obtain tokens to call protected APIs.

  • Microsoft.AspNetCore.Components.WebAssembly.Authentication provides security with authentication for Blazor WebAssembly apps. This package includes services that can provision access tokens for an application.

  • Microsoft.Authentication.WebAssembly.Msal provides types for using the Microsoft Authentication Library (MSAL) with Blazor WebAssembly. It authenticates Blazor webassembly applications with Azure Active Directory and Azure Active Directory B2C.

Note:

The Microsoft.Authentication.WebAssembly.Msalpackage transitively adds the Microsoft.AspNetCore.Components.WebAssembly.Authentication package to the app.

This is why, Microsoft.Authentication.WebAssembly.Msal package is better than Microsoft.AspNetCore.Components.WebAssembly.Authentication package.

  • To install Microsoft.Authentication.WebAssembly.Msal package include it like below:
 Install-Package Microsoft.Authentication.WebAssembly.Msal -Version 6.0.4
  • To use Microsoft.AspNetCore.Components.WebAssembly.Authentication package refer the MsDoc.

For more information, please refer below links:

Ref1 , Ref2 , Ref3.

  • Related