Return a HTTP 401 instead of 404 if token is not found

This commit is contained in:
Quentin de Quelen 2019-11-20 14:06:56 +01:00
parent 5f0f699f37
commit 878dd6912e

View File

@ -38,9 +38,9 @@ impl ContextExt for Context<Data> {
.common_store()
.get::<Str, SerdeBincode<Token>>(&reader, &token_key)
.map_err(ResponseError::internal)?
.ok_or(ResponseError::not_found(format!(
"token key: {}",
token_key
.ok_or(ResponseError::invalid_token(format!(
"token key does not exist: {}",
user_api_key
)))?;
if token_config.revoked {