diff --git a/waspc/data/Generator/templates/server/src/auth/providers/index.ts b/waspc/data/Generator/templates/server/src/auth/providers/index.ts index 0883aa2ea..36057ee76 100644 --- a/waspc/data/Generator/templates/server/src/auth/providers/index.ts +++ b/waspc/data/Generator/templates/server/src/auth/providers/index.ts @@ -1,6 +1,8 @@ {{={= =}=}} import { Router } from "express"; +{=# isExternalAuthEnabled =} import { setupOneTimeCodeRoute } from "./oauth/oneTimeCode"; +{=/ isExternalAuthEnabled =} {=# providers =} {=& importStatement =} @@ -14,9 +16,11 @@ const providers = [ const router = Router(); +{=# isExternalAuthEnabled =} // Setting up a common route for all OAuth providers to exchange // one-time code for a session. setupOneTimeCodeRoute(router); +{=/ isExternalAuthEnabled =} for (const provider of providers) { const { createRouter } = provider; diff --git a/waspc/src/Wasp/Generator/ServerGenerator/AuthG.hs b/waspc/src/Wasp/Generator/ServerGenerator/AuthG.hs index 93ec7fda3..2b1e686a7 100644 --- a/waspc/src/Wasp/Generator/ServerGenerator/AuthG.hs +++ b/waspc/src/Wasp/Generator/ServerGenerator/AuthG.hs @@ -71,7 +71,11 @@ genAuthRoutesIndex auth = return $ C.mkTmplFdWithDstAndData tmplFile dstFile (Ju genProvidersIndex :: AS.Auth.Auth -> Generator FileDraft genProvidersIndex auth = return $ C.mkTmplFdWithData [relfile|src/auth/providers/index.ts|] (Just tmplData) where - tmplData = object ["providers" .= providers] + tmplData = + object + [ "providers" .= providers, + "isExternalAuthEnabled" .= AS.Auth.isExternalAuthEnabled auth + ] providers = makeConfigImportJson