diff --git a/app/Firebase/firebase.js b/app/Firebase/firebase.js index 9479ef4..af936c0 100644 --- a/app/Firebase/firebase.js +++ b/app/Firebase/firebase.js @@ -1,6 +1,5 @@ - import { initializeApp } from 'firebase/app'; -import { getAuth, GoogleAuthProvider } from 'firebase/auth'; +import { getAuth, GoogleAuthProvider, GithubAuthProvider } from 'firebase/auth'; const firebaseConfig = { apiKey: 'YOUR_API_KEY', @@ -17,4 +16,7 @@ const app = initializeApp(firebaseConfig); // Initialize Firebase Authentication and get a reference to the service const auth = getAuth(app); -export { auth, GoogleAuthProvider }; +// Initialize GitHub Auth Provider +const githubProvider = new GithubAuthProvider(); + +export { auth, GoogleAuthProvider, githubProvider }; diff --git a/app/login/page.tsx b/app/login/page.tsx index a337ef7..2f2e8d8 100644 --- a/app/login/page.tsx +++ b/app/login/page.tsx @@ -4,8 +4,8 @@ import React, { useState } from "react"; import { useForm } from "react-hook-form"; import * as z from "zod"; import { zodResolver } from "@hookform/resolvers/zod"; -import { getAuth, GoogleAuthProvider, signInWithPopup } from "firebase/auth"; -import { auth } from "../Firebase/firebase"; // Assuming you have a firebaseConfig file +import { getAuth, GoogleAuthProvider, signInWithPopup, GithubAuthProvider } from "firebase/auth"; +import { auth,githubProvider } from "../Firebase/firebase"; // Assuming you have a firebaseConfig file import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faEye, faEyeSlash, faHouse } from '@fortawesome/free-solid-svg-icons'; import { useRouter } from 'next/navigation'; @@ -68,7 +68,15 @@ export default function SignInSignUp() { console.error("Google Sign-In error:", error); } }; - + const handleGithubSignIn = async () => { + try { + const result = await signInWithPopup(auth, githubProvider); + const user = result.user; + console.log("GitHub Sign-In successful:", user); + } catch (error) { + console.error("GitHub Sign-In error:", error); + } + }; const handleOnClick = (text: string) => { if (text !== type) { setType(text); @@ -415,6 +423,9 @@ export default function SignInSignUp() { + + + or use your email for registration + + + or use your account ); -} +} \ No newline at end of file