fix: Use correct config for auth methods per actor (#7515)
This commit is contained in:
@@ -14,10 +14,11 @@ export const GET = async (req: MedusaRequest, res: MedusaResponse) => {
|
||||
ContainerRegistrationKeys.CONFIG_MODULE
|
||||
)
|
||||
|
||||
const authMethods = (config.projectConfig?.http as any)?.authMethods ?? {}
|
||||
const authMethodsPerActor =
|
||||
config.projectConfig?.http?.authMethodsPerActor ?? {}
|
||||
// Not having the config defined would allow for all auth providers for the particular actor.
|
||||
if (authMethods[actor_type]) {
|
||||
if (!authMethods[actor_type].includes(auth_provider)) {
|
||||
if (authMethodsPerActor[actor_type]) {
|
||||
if (!authMethodsPerActor[actor_type].includes(auth_provider)) {
|
||||
throw new MedusaError(
|
||||
MedusaError.Types.NOT_ALLOWED,
|
||||
`The actor type ${actor_type} is not allowed to use the auth provider ${auth_provider}`
|
||||
|
||||
@@ -14,10 +14,11 @@ export const GET = async (req: MedusaRequest, res: MedusaResponse) => {
|
||||
ContainerRegistrationKeys.CONFIG_MODULE
|
||||
)
|
||||
|
||||
const authMethods = (config.projectConfig?.http as any)?.authMethods ?? {}
|
||||
const authMethodsPerActor =
|
||||
config.projectConfig?.http?.authMethodsPerActor ?? {}
|
||||
// Not having the config defined would allow for all auth providers for the particular actor.
|
||||
if (authMethods[actor_type]) {
|
||||
if (!authMethods[actor_type].includes(auth_provider)) {
|
||||
if (authMethodsPerActor[actor_type]) {
|
||||
if (!authMethodsPerActor[actor_type].includes(auth_provider)) {
|
||||
throw new MedusaError(
|
||||
MedusaError.Types.NOT_ALLOWED,
|
||||
`The actor type ${actor_type} is not allowed to use the auth provider ${auth_provider}`
|
||||
|
||||
Reference in New Issue
Block a user