auth: show better error if auth provider keys are missing

Signed-off-by: Himanshu Mishra <himanshu@orkohunter.net>
This commit is contained in:
Himanshu Mishra
2021-06-22 20:16:26 +02:00
parent e30ffe2225
commit 8e5e5ee46e
+10 -1
View File
@@ -139,7 +139,16 @@ export async function createRouter({
router.use('/:provider/', req => {
const { provider } = req.params;
throw new NotFoundError(`No auth provider registered for '${provider}'`);
if (providers.includes(provider)) {
// If they added the provider under auth.providers but the clientId and clientSecret etc. were not found.
throw new NotFoundError(
`Auth provider registered for '${provider}' is misconfigured. This could mean the configs under ` +
`auth.providers.${provider} are missing or the environment variables used are not defined. ` +
`Check the auth backend plugin logs when the backend starts to see more details.`,
);
} else {
throw new NotFoundError(`No auth provider registered for '${provider}'`);
}
});
return router;