From 488775df32270b31152869da0b17be1795c8654a Mon Sep 17 00:00:00 2001 From: Nick Cherry Date: Tue, 30 Jan 2024 16:27:19 -0500 Subject: [PATCH] remove old routes --- web/src/app/api/auth/[...nextauth]/route.ts | 62 --------------------- 1 file changed, 62 deletions(-) delete mode 100644 web/src/app/api/auth/[...nextauth]/route.ts diff --git a/web/src/app/api/auth/[...nextauth]/route.ts b/web/src/app/api/auth/[...nextauth]/route.ts deleted file mode 100644 index 35c4c71..0000000 --- a/web/src/app/api/auth/[...nextauth]/route.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { createAppClient, viemConnector } from "@farcaster/auth-client"; -import NextAuth from "next-auth"; -import CredentialsProvider from "next-auth/providers/credentials"; - -import { getProfile } from "../../../../lib/services/user"; - -export const authOptions = { - providers: [ - CredentialsProvider({ - name: "Sign in with Farcaster", - credentials: { - message: { - label: "Message", - type: "text", - placeholder: "0x0", - }, - signature: { - label: "Signature", - type: "text", - placeholder: "0x0", - }, - csrfToken: { - type: "text", - }, - }, - async authorize(credentials) { - const appClient = createAppClient({ - ethereum: viemConnector(), - }); - - const verifyResponse = await appClient.verifySignInMessage({ - message: credentials!.message as string, - signature: credentials!.signature as `0x${string}`, - domain: "example.com", - nonce: credentials!.csrfToken, - }); - - const { success, fid } = verifyResponse; - - if (!success) { - return null; - } - - return { - id: fid.toString(), - }; - }, - }), - ], - callbacks: { - async session({ session, token }: any) { - const profile = await getProfile({ fid: token.sub }); - session.user = profile; - return session; - }, - }, -}; - -const auth = NextAuth(authOptions) as any; - -export const GET = auth; -export const POST = auth;