From 8e5e5ee46e51fd4f9f5e570f58553c50d523277f Mon Sep 17 00:00:00 2001 From: Himanshu Mishra Date: Tue, 22 Jun 2021 20:16:26 +0200 Subject: [PATCH] auth: show better error if auth provider keys are missing Signed-off-by: Himanshu Mishra --- plugins/auth-backend/src/service/router.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/auth-backend/src/service/router.ts b/plugins/auth-backend/src/service/router.ts index fa551f6ec2..a79ad66179 100644 --- a/plugins/auth-backend/src/service/router.ts +++ b/plugins/auth-backend/src/service/router.ts @@ -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;