curl --request GET \
--url https://api.example.com/auth/isloggedin \
--header 'x-access'\''courser-auth-token: <x-access'\''courser-auth-token>'{
"user": {
"_id": "<string>",
"email": "<string>",
"name": "<string>",
"courses": [
"<string>"
]
}
}Verify a JWT token and retrieve the authenticated user’s profile.
curl --request GET \
--url https://api.example.com/auth/isloggedin \
--header 'x-access'\''courser-auth-token: <x-access'\''courser-auth-token>'{
"user": {
"_id": "<string>",
"email": "<string>",
"name": "<string>",
"courses": [
"<string>"
]
}
}x-access'courser-auth-token header.Show user properties
| Response body | Cause |
|---|---|
"not-logged-in" | The x-access'courser-auth-token header is absent |
"no user found" | Token is valid but no matching user exists in the database |
"ERROR" | Token verification failed (invalid signature or expired) |
curl --request GET \
--url http://localhost:8000/auth/isloggedin \
--header "x-access'courser-auth-token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
{
"user": {
"_id": "a3f8c1e09b2d7f4e6a1c3d5b",
"email": "[email protected]",
"name": "Dr. Jane Smith",
"courses": [
"64b1f2e3c4a5d6f7e8a9b0c1",
"64b1f2e3c4a5d6f7e8a9b0c2"
]
}
}
"not-logged-in"