Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/shadynagy/b2c-blazor-wasm-31

Secure an ASP.NET Core Blazor WebAssembly hosted app with Azure Active Directory B2C (Without implicit grant).
https://github.com/shadynagy/b2c-blazor-wasm-31

azure azure-b2c b2c blazor blazor-client blazor-client-side blazor-wasm blazor-webassembly implicit microsoft microsoft-azure msal msal-browser msal-library netcore netcore31 netstandard netstandard21 wasm webassembly

Last synced: 30 days ago
JSON representation

Secure an ASP.NET Core Blazor WebAssembly hosted app with Azure Active Directory B2C (Without implicit grant).

Awesome Lists containing this project

README

        

# Azure B2C Blazor WASM Working with 3.1

### Secure an ASP.NET Core Blazor WebAssembly hosted app with Azure Active Directory B2C
### Azure B2C not working in Blazor WASM (netstandard2.1) without the implicit grant so that is the solution

1- Create the app [Microsoft Documentation](https://docs.microsoft.com/en-us/aspnet/core/blazor/security/webassembly/hosted-with-azure-active-directory-b2c?view=aspnetcore-3.1)

2- Copy file AuthenticationService.js from src folder to your Blazor WASM project (B2CWasm.Client) in wwwroot folder.

3- Change index.html in wwwroot folder from
```html

```
to
```html

```

4- add this package to server
```xml

```
5- in WeatherForecastController
```csharp
...
using Microsoft.Identity.Web.Resource;
...

public class WeatherForecastController : ControllerBase
{
...
static readonly string[] scopeRequiredByApi = new string[] { "your scop name" };
...
[HttpGet]
public IEnumerable Get()
{
HttpContext.VerifyUserHasAnyAcceptedScope(scopeRequiredByApi);

...
}
}
```