Skip to content

Latest commit

 

History

History

sample

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Logto ASP.NET Core sample project

This sample project shows how to use the Logto ASP.NET Core authentication middleware to authenticate users with Logto.

Prerequisites

  • .NET 6.0 or higher
  • 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