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 14, 2024
1 parent f204319 commit 17f3cdf
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions packages/ui/src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,24 @@ nodekit.ctx.log('AppConfig details', {
appDevMode,
});

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

const authMiddlewares = [];

if (ytOAuthSettings) {
authMiddlewares.push(authorizationResolver(createOAuthAuthorizationResolver()));
}

if (allowPasswordAuth) {
authMiddlewares.push(authorizationResolver(createYTAuthorizationResolver()));
}

if (authMiddlewares.length) {
nodekit.config.appBeforeAuthMiddleware = [
...(nodekit.config.appBeforeAuthMiddleware || []),
authorizationResolver(createOAuthAuthorizationResolver()),
authorizationResolver(createYTAuthorizationResolver()),
...authMiddlewares,
];

nodekit.config.appAuthHandler = createAuthMiddleware();
}

Expand Down

0 comments on commit 17f3cdf

Please sign in to comment.