Improved error messages for failed authorization

This commit is contained in:
Kevin Ansfield 2019-02-21 13:19:57 +07:00
parent 03d4843628
commit 288a38036b
2 changed files with 7 additions and 3 deletions

View File

@ -52,7 +52,8 @@ const authorize = {
return next();
}
return next(new common.errors.NoPermissionError({
message: common.i18n.t('errors.middleware.auth.pleaseSignInOrAuthenticate')
message: common.i18n.t('errors.middleware.auth.authorizationFailed'),
context: common.i18n.t('errors.middleware.auth.missingContentMemberOrIntegration')
}));
},
@ -70,7 +71,8 @@ const authorize = {
return next();
} else {
return next(new common.errors.NoPermissionError({
message: common.i18n.t('errors.middleware.auth.pleaseSignInOrAuthenticate')
message: common.i18n.t('errors.middleware.auth.authorizationFailed'),
context: common.i18n.t('errors.middleware.auth.missingAdminUserOrIntegration')
}));
}
}

View File

@ -78,7 +78,9 @@
"missingUserIDForSession": "Cannot create session without user id.",
"accessDenied": "Access denied.",
"pleaseSignIn": "Please Sign In",
"pleaseSignInOrAuthenticate": "Please sign in or authenticate with an API Key",
"authorizationFailed": "Authorization failed",
"missingContentMemberOrIntegration": "Unable to determine the authenticated member or integration. Check the supplied Content API Key and ensure cookies are being passed through if member auth is failing.",
"missingAdminUserOrIntegration": "Unable to determine the authenticated user or integration. Check that cookies are being passed through if using session authentication.",
"adminApiKeyMissing": "Admin API Key missing.",
"unknownAdminApiKey": "Unknown Admin API Key",
"unknownContentApiKey": "Unknown Content API Key",