Integration Testing JWT-Protected APIs with .NET Aspire
Most tutorials on JWT authentication stop at "add AddJwtBearer() and configure the options." But the moment you have multiple services behind bearer tokens and a test project that needs to call them all, the configuration plumbing gets painful: every service needs the same signing key, the same issuer, the same audience, and the test project needs to mint tokens and discover service endpoints. In this article we'll look at a .NET Aspire playground that solves all of this with a single shared development JWT authority โ and takes it a step further by running the test project inside the Aspire orchestrator so every test appears as a traced span in the dashboard.