Skip to content

monocloud/dotnet-api-authentication-quickstart

Repository files navigation


.NET API Authentication Quickstart

A minimal ASP.NET Core (minimal API) example showing how to protect API endpoints with access token validation using MonoCloud.

What this repo shows

  • MonoCloud access token validation with ASP.NET Core
  • Endpoint protection via the standard authentication and authorization pipeline
  • Accessing the authenticated user's claims

Built with MonoCloud.Authentication.Api.

Prerequisites

Before you begin:

  1. In the MonoCloud Dashboard, create a new API
  2. Set the Audience (for example https://api.example.com) — this uniquely identifies your API
  3. Add a scope named example-api and mark the scope as a default scope

You'll also need the .NET SDK (10.0 or later).

Configure the application

This repo reads its configuration from appsettings.json. Replace the placeholders with values from your API:

"MonoCloud": {
  "TenantDomain": "https://<your-domain>",
  "Audience": "https://<your-api-audience>"
}

Do not commit real secrets. For production, use environment variables, user secrets, or a secure secret store.

Run locally

dotnet run

The server starts on http://localhost:3000.

Test

curl -H "Authorization: Bearer <your-access-token>" http://localhost:3000/api/protected

📘 Learn more

🤝 Contributing & Support

Issues & Feedback

  • Use GitHub Issues for bug reports and feature requests.
  • For tenant or account-specific help, contact MonoCloud Support through your dashboard.

Security

Do not report security issues publicly. Please follow the contact instructions at: https://www.monocloud.com/contact

License

Licensed under the MIT License. See the included LICENSE file.

Releases

Packages

Used by

Contributors

Languages