Protect the Web API
Learn to protect the API called by the Blazor WebAssembly application.
We'll cover the following...
To protect the weather forecast API from unauthorized access, we need to configure and modify the Server project of the Blazor WebAssembly solution.
The server configuration
First, we need to let our API know about Auth0 settings. Therefore, let’s move to the Server project, open the appsettings.json, and apply the changes shown below:
Press + to interact
{"Logging": {"LogLevel": {"Default": "Information","Microsoft.AspNetCore": "Warning"}},"AllowedHosts": "*","Auth0": {"Domain": "YOUR_AUTH0_DOMAIN","Audience": "YOUR_API_IDENTIFIER"}}
We added the "Auth0" section in the configuration file with two keys— "Domain" and "Audience".
Let’s replace the ...
Ask