### Install Logto ASP.NET Core Authentication Package Source: https://github.com/logto-io/csharp/blob/master/src/Logto.AspNetCore.Authentication/README.md Install the Logto ASP.NET Core Authentication NuGet package using the .NET CLI. This command adds the necessary package to your project. ```bash dotnet add package Logto.AspNetCore.Authentication ``` -------------------------------- ### Running the Sample Project Source: https://github.com/logto-io/csharp/blob/master/samples/sample-blazor/README.md Execute the sample project using the .NET CLI. Use `dotnet run` for a standard execution or `dotnet watch` for development with automatic restarts on file changes. ```bash dotnet run # or `dotnet watch` to run in watch mode ``` -------------------------------- ### Logto API Resource Configuration Source: https://github.com/logto-io/csharp/blob/master/samples/sample-blazor/README.md Add the `Resource` key to the Logto configuration in `appsettings.Development.json` if you need to test API resource integration. ```json { // ... "Logto": { // ... "Resource": "https://" } } ``` -------------------------------- ### Configure JWT Access Token for API Resources Source: https://github.com/logto-io/csharp/blob/master/samples/sample-wasm/README.md Configure the 'Resource' and 'ExtraTokenParams' to fetch a JWT access token for an API resource. The value for 'Resource' and the 'resource' key within 'ExtraTokenParams' must be identical and represent your API resource indicator. ```json { // ... "IdentityServer": { // ... "Resource": "https://", "ExtraTokenParams": { "resource": "https://" // Ensure the key is lowercase } } } ``` -------------------------------- ### Enable Loading User Info in Blazor WASM Source: https://github.com/logto-io/csharp/blob/master/samples/sample-wasm/README.md To fetch special claims like 'custom_data', enable the 'LoadUserInfo' configuration. Note that this setting conflicts with fetching access tokens for API resources in a client-side WebAssembly application. ```json { // ... "IdentityServer": { // ... "LoadUserInfo": true } } ``` -------------------------------- ### Logto Configuration for Blazor WASM Source: https://github.com/logto-io/csharp/blob/master/samples/sample-wasm/README.md Configure the IdentityServer settings in appsettings.Development.json for Blazor WebAssembly applications using Logto. Ensure Authority, ClientId, PostLogoutRedirectUri, and RedirectUri are correctly set. Remember to configure these URIs in your Logto application settings. ```json { // ... "IdentityServer": { "Authority": "https:///oidc", "ClientId": "", "PostLogoutRedirectUri": "", // Remember to configure this in Logto "RedirectUri": "", // Remember to configure this in Logto "ResponseType": "code", "Scope": "openid profile" // Add more scopes if needed } } ``` -------------------------------- ### Logto Configuration in appsettings.Development.json Source: https://github.com/logto-io/csharp/blob/master/samples/sample-blazor/README.md Configure Logto authentication settings, including the endpoint, application ID, and application secret. This JSON structure is used in the `appsettings.Development.json` file. ```json { // ... "Logto": { "Endpoint": "https:///", "AppId": "", "AppSecret": "" } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.