diff --git a/client/Dockerfile.production b/client/Dockerfile.production index cf50c73..ea6b037 100644 --- a/client/Dockerfile.production +++ b/client/Dockerfile.production @@ -17,6 +17,9 @@ COPY postcss.config.mjs ./postcss.config.mjs ARG NEXT_PUBLIC_API_URL ENV NEXT_PUBLIC_API_URL ${NEXT_PUBLIC_API_URL} +ARG JWT_PUBLIC_KEY +ENV JWT_PUBLIC_KEY ${JWT_PUBLIC_KEY} + RUN npm run build CMD npm start \ No newline at end of file diff --git a/client/src/middleware.ts b/client/src/middleware.ts index 2d3fbac..258ca7e 100644 --- a/client/src/middleware.ts +++ b/client/src/middleware.ts @@ -10,7 +10,9 @@ const privateUrls = ['/admin', '/profile']; async function importKey() { const alg = 'RS256'; const spki = process.env.JWT_PUBLIC_KEY!; + console.log('spki', spki); const publicKey = await jose.importSPKI(spki, alg); + console.log('publicKey', publicKey); return publicKey; } @@ -33,6 +35,7 @@ async function authMiddleware(request: NextRequest) { if (token) { try { const key = await importKey(); + console.log(key); const { payload } = await jose.jwtVerify(token, key); console.log('payload', payload); if (payload.sub) return NextResponse.next();