Files
medusa-store/packages/medusa/src/api/cloud/middlewares.ts
Pedro Guzman 001923da2b feat: add Medusa Cloud OAuth provider (#14395)
* feat: add Medusa Cloud OAuth provider

* add Cloud login button

* fetch whether cloud auth is enabled through api

* allow unregistered to get session

* handle existing users

* address PR comments

* prevent double execution

* a few more fixes

* fix callback url

* fix spelling

* refresh session

* 200 instead of 201

* only allow cloud identities to create user

* fix condition
2025-12-30 17:30:10 +01:00

20 lines
485 B
TypeScript

import { authenticate, MiddlewareRoute } from "@medusajs/framework/http"
export const cloudRoutesMiddlewares: MiddlewareRoute[] = [
{
matcher: "/cloud/auth",
method: ["GET"],
middlewares: [],
},
{
matcher: "/cloud/auth/users",
method: ["POST"],
middlewares: [
// Allow users who are authenticated but don't yet have an actor (user record)
authenticate("user", ["session", "bearer"], {
allowUnregistered: true,
}),
],
},
]