* 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
20 lines
485 B
TypeScript
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,
|
|
}),
|
|
],
|
|
},
|
|
]
|