From b5f18910abc076c57f968a41ae3f188dec1b7171 Mon Sep 17 00:00:00 2001 From: pradeepkumar Date: Mon, 22 Dec 2025 16:48:36 +0530 Subject: [PATCH] feat: add Twitter authentication provider and update sign-in callback to include it --- src/auth.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/auth.ts b/src/auth.ts index 02f89a1..7dc9964 100644 --- a/src/auth.ts +++ b/src/auth.ts @@ -1,6 +1,7 @@ import NextAuth from "next-auth"; import Google from "next-auth/providers/google"; import Facebook from "next-auth/providers/facebook"; +import Twitter from "next-auth/providers/twitter"; import Credentials from "next-auth/providers/credentials"; export const { handlers, signIn, signOut, auth } = NextAuth({ @@ -17,6 +18,12 @@ export const { handlers, signIn, signOut, auth } = NextAuth({ clientSecret: process.env.FACEBOOK_CLIENT_SECRET!, }), + // Twitter OAuth + Twitter({ + clientId: process.env.TWITTER_CLIENT_ID!, + clientSecret: process.env.TWITTER_CLIENT_SECRET!, + }), + // Email/Password (Credentials) Credentials({ name: "credentials", @@ -64,7 +71,7 @@ export const { handlers, signIn, signOut, auth } = NextAuth({ callbacks: { async signIn({ user, account }) { // For OAuth providers, sync with backend - if (account?.provider === "google" || account?.provider === "facebook") { + if (account?.provider === "google" || account?.provider === "facebook" || account?.provider === "twitter") { try { const res = await fetch( `${process.env.NEXT_PUBLIC_API_URL}/auth/social`,