Karve app icon

Karve

ASP.NET Core aspnet-core-jwt-login.http

ASP.NET Core JWT login .http example

Run a JSON login, inspect the returned JWT, then test a protected endpoint with the bearer header.

aspnet-core-jwt-login.http

@baseUrl = https://localhost:7001
@email = developer@example.com
@password = replace-with-password
@token = replace-with-token-from-login-response

### Log in and receive a JWT
POST {{baseUrl}}/auth/login
Accept: application/json
Content-Type: application/json

{
  "email": "{{email}}",
  "password": "{{password}}"
}

### Call a protected endpoint after manually copying the JWT above
GET {{baseUrl}}/me
Accept: application/json
Authorization: Bearer {{token}}

Variables to replace

baseUrl
Your ASP.NET Core HTTPS launch URL.
email
A test account email.
password
A safe placeholder for the test password.
token
The JWT copied from the login response.

Expected response

A valid login usually returns 200 OK with a JWT. Copy that value into token before running the second request, which should return 200 OK for an authenticated user.

Karve does not extract the JWT from the first response. The token copy is intentionally manual.

Related examples and guides

Learn the full syntax in the .http file format guide, manage secrets with variables and environments, or see how to run .http files on Windows.

Launch Summer Sale

Run this request without leaving Windows.

Karve opens .http files as a native workspace: edit the plain text, press Run, inspect the response, and keep the file in Git.

15-day free trial · No account · No subscription · No metered requests

25% off until Sep 1