message: remove the "catch-all" auth endpoint and register each separately
  200: for properly registered auth providers
  404 (with proper message): misconfigured
  404 (plain): for unknown providers
diff: @@ -86,9 +86,10 @@ export async function createRouter({
  ...providerFactories,
  };
  const providersConfig = config.getConfig('auth.providers');
  - const providers = providersConfig.keys();
  + const configuredProviders = providersConfig.keys();
  - for (const providerId of providers) {
  + for (const providerId of Object.keys(allProviderFactories)) {
  + if (configuredProviders.includes(providerId)) {
  logger.info(`Configuring provider, ${providerId}`);
  try {
  const providerFactory = allProviderFactories[providerId];
  @@ -127,6 +128,22 @@ export async function createRouter({
  }
  logger.warn(`Skipping ${providerId} auth provider, ${e.message}`);
  +
  + router.use(`/${providerId}`, () => {
  + // If the user added the provider under auth.providers but the clientId and clientSecret etc. were not found.
  + throw new NotFoundError(
  + `Auth provider registered for '${providerId}' is misconfigured. This could mean the configs under ` +
  + `auth.providers.${providerId} 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 {
  + router.use(`/${providerId}`, () => {
  + throw new NotFoundError(
  + `No auth provider registered for '${providerId}'`,
  + );
  + });
  }
  }
  @@ -137,19 +154,5 @@ export async function createRouter({
  }),
  );
  - router.use('/:provider/', req => {
  - const { provider } = req.params;
  - if (providers.includes(provider)) {
  - // If the user 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;
  }
  