Hi <#C0A974TJ9|ktor>! I am using Authentication wi...
# ktor
j
Hi #ktor! I am using Authentication with JWT, and I'm trying to report better errors in certain cases. If the JWT token included in the
Authorization
header isn't a valid JWT token (misconfigured environment might pass
null
or empty string) I want to log an error on the server "Missing or Invalid JWT Token". Is there a place I can do this?
Follow up on this: I figured it out; just add a
challenge
section below your
validate {}
block, like this
Copy code
validate {
   ...
}

challenge { _, _ ->
    reportJwtChallengeError(context)
    call.respond(HttpStatusCode.Unauthorized)
}