diff --git a/packages/medusa-plugin-auth/src/api/index.ts b/packages/medusa-plugin-auth/src/api/index.ts index 478b332..d85e00e 100644 --- a/packages/medusa-plugin-auth/src/api/index.ts +++ b/packages/medusa-plugin-auth/src/api/index.ts @@ -11,15 +11,19 @@ import AzureStrategy from '../auth-strategies/azure-oidc'; import { AuthOptions, AuthOptionsWrapper, handleOption } from '../types'; -export default async function (rootDirectory, pluginOptions: AuthOptions[]): Promise { +export default async function (rootDirectory, pluginOptions: AuthOptions | AuthOptions[]): Promise { const configModule = loadConfig(rootDirectory); return loadRouters(configModule, pluginOptions); } -async function loadRouters(configModule: ConfigModule, options: AuthOptionsWrapper[]): Promise { +async function loadRouters( + configModule: ConfigModule, + options: AuthOptionsWrapper | AuthOptionsWrapper[] +): Promise { const routers: Router[] = []; - for (const opt of options) { + const options_ = Array.isArray(options) ? options : [options]; + for (const opt of options_) { const option = await handleOption(opt, configModule); switch (option.type) {