๖ۜßᵿ
๖ۜßᵿ
HHono
Created by ๖ۜßᵿ on 10/12/2024 in #help
Cannot parse action at /api/auth/providers also /api/auth/error (Next Auth .vs Cognito AWS)
Hi, I'm trying to integrate Hono.js with my Next.js App using Auth.js and Cognito AWS. I've follow the example repo here: https://github.com/divyam234/next-auth-hono-react, but it seem to not working as expected. This is my implemented code: // ./api.ts import { Hono } from "hono"; import { authHandler, initAuthConfig, verifyAuth } from "@hono/auth-js"; import Cognito from "@auth/core/providers/cognito"; const app = new Hono({ strict: false }).basePath("/"); app.use( "", initAuthConfig((c) => ({ secret: c.env.AUTH_SECRET, providers: [ Cognito({ clientId: c.env.COGNITO_CLIENT_ID, clientSecret: c.env.COGNITO_CLIENT_SECRET, issuer: c.env.COGNITO_ISSUER, }), ], })) ); app.use("/api/auth/", authHandler()); app.use("/api/*", verifyAuth()); app.get("/api/protected", async (c) => { const auth = c.get("authUser"); return c.json(auth); }); export default app; // ./app/api/[[...route]]/route.ts import { handle } from "hono/vercel"; import app from "@/api"; export const GET = handle(app); export const POST = handle(app); export const PUT = handle(app); export const DELETE = handle(app); export const PATCH = handle(app);
1 replies