ai_saas_app icon indicating copy to clipboard operation
ai_saas_app copied to clipboard

Cant´see Clerk layout - "Third-party cookie will be blocked

Open NiFlowersBrain opened this issue 1 year ago • 2 comments

Chrome browser is blocking Clerk as it says "Third-party cookie will be blocked. As a result you cannot see or use Clerk application within the web.

NiFlowersBrain avatar Apr 11 '24 14:04 NiFlowersBrain

https://developers.google.com/privacy-sandbox/3pcd?hl=es-419, le recomiendo leer este articulo donde se menciona el bloqueo de cookies de terceros en 2024. ahora en cuanto no pueda utilizar clerk, es probanble que:

  • si usa src/ archivo middleware.ts tiene que estar en la carpeta /src y no en la raíz del proyecto
  • authMiddleware esta desfasado y ahora se usa clerkMiddleware() a diferencia del primero que proteje todas las rutas por defecto clerkMiddleware() no proteje ninguna ruta por defecto. por ello tiene que hacer esto en middleware.ts:
// para proteger la ruta / que es la home y todas las rutas de credits
const isProtectedRoute = createRouteMatcher(["/", "/credits(.*)"]);

export default clerkMiddleware((auth, req) => {
  if (isProtectedRoute(req)) auth().protect();
});
export const config = {
  matcher: ["/((?!.*\\..*|_next).*)", "/", "/(api|trpc)(.*)"],
};

Oliver-1311 avatar May 03 '24 01:05 Oliver-1311

facing the same thing

Ice-wiz avatar Jun 04 '24 20:06 Ice-wiz