Skip to content

Commit

Permalink
fix: oauth should be independent from allowPasswordAuth [#349]
Browse files Browse the repository at this point in the history
  • Loading branch information
vitshev committed Feb 9, 2024
1 parent 04046cc commit 8af0d99
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions packages/ui/src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,23 @@ nodekit.ctx.log('AppConfig details', {
appDevMode,
});

const {allowPasswordAuth} = nodekit.config;
const {allowPasswordAuth, ytOAuthSettings} = nodekit.config;

const middlewares = [...(nodekit.config.appBeforeAuthMiddleware || [])];

if (allowPasswordAuth) {
nodekit.config.appBeforeAuthMiddleware = [
...(nodekit.config.appBeforeAuthMiddleware || []),
authorizationResolver(createOAuthAuthorizationResolver()),
...middlewares,
authorizationResolver(createYTAuthorizationResolver()),
];
} else if (ytOAuthSettings) {
nodekit.config.appBeforeAuthMiddleware = [
...middlewares,
authorizationResolver(createOAuthAuthorizationResolver()),
];
}

if (allowPasswordAuth || ytOAuthSettings) {
nodekit.config.appAuthHandler = createAuthMiddleware();
}

Expand Down

0 comments on commit 8af0d99

Please sign in to comment.