This sample project shows how to use the Logto ASP.NET Core authentication middleware to authenticate users with Logto.
- .NET 6.0 or higher
- A Logto Cloud account or a self-hosted Logto
- A Logto traditional web application created
- 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.
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>"
}
}
dotnet run # or `dotnet watch` to run in watch mode