0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

fix(core): mount OIDC after all middlewares (#3181)

This commit is contained in:
simeng-li 2023-02-24 10:11:51 +08:00 committed by GitHub
parent c540fe5c60
commit 1ae64f41cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -64,9 +64,6 @@ export default class Tenant implements TenantContext {
// Init app // Init app
const app = new Koa(); const app = new Koa();
const provider = initOidc(envSet, queries, libraries);
app.use(mount('/oidc', provider.app));
app.use(koaLogger()); app.use(koaLogger());
app.use(koaErrorHandler()); app.use(koaErrorHandler());
app.use(koaOIDCErrorHandler()); app.use(koaOIDCErrorHandler());
@ -74,6 +71,10 @@ export default class Tenant implements TenantContext {
app.use(koaConnectorErrorHandler()); app.use(koaConnectorErrorHandler());
app.use(koaI18next()); app.use(koaI18next());
// Mount OIDC
const provider = initOidc(envSet, queries, libraries);
app.use(mount('/oidc', provider.app));
const tenantContext: TenantContext = { id, provider, queries, libraries, modelRouters, envSet }; const tenantContext: TenantContext = { id, provider, queries, libraries, modelRouters, envSet };
// Mount APIs // Mount APIs
app.use(mount('/api', initApis(tenantContext))); app.use(mount('/api', initApis(tenantContext)));