Skip to content

Latest commit

 

History

History
48 lines (35 loc) · 1.28 KB

File metadata and controls

48 lines (35 loc) · 1.28 KB

Logto ASP.NET Core sample project for MVC

This sample project shows how to use the Logto ASP.NET Core authentication middleware to authenticate users with Logto in a Blazor Server application.

Prerequisites

  • .NET 8.0 or higher (This sample is created with the new Blazor template in .NET 8.0)
  • A Logto Cloud account or a self-hosted Logto
  • A Logto traditional web application created

Optional

  • Set up an API resource in Logto

If you don't have the Logto application created, please follow the ⚡ Get started guide to create one.

Configuration

Create an appsettings.Development.json (or appsettings.json) with the following structure:

{
  // ...
  "Logto": {
    "Endpoint": "https://<your-logto-endpoint>/",
    "AppId": "<your-logto-app-id>",
    "AppSecret": "<your-logto-app-secret>"
  }
}

If you need to test API resource, add the Resource key:

{
  // ...
  "Logto": {
    // ...
    "Resource": "https://<your-api-resource-indicator>"
  }
}

Run the sample

dotnet run # or `dotnet watch` to run in watch mode