{"id":16057775,"url":"https://github.com/matterhorn-studios/reactfbauth","last_synced_at":"2026-04-12T12:48:20.507Z","repository":{"id":57698179,"uuid":"500210162","full_name":"Matterhorn-Studios/ReactFBAuth","owner":"Matterhorn-Studios","description":"A simple ReactJS package ment to make ReactJS/NextJS Firebase authentication easy.","archived":false,"fork":false,"pushed_at":"2022-06-06T23:30:33.000Z","size":182,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-05T08:14:33.340Z","etag":null,"topics":["authentication","firebase","firebase-auth","nextjs","react","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Matterhorn-Studios.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-05T20:56:36.000Z","updated_at":"2024-09-19T21:56:47.000Z","dependencies_parsed_at":"2022-08-25T19:01:50.519Z","dependency_job_id":null,"html_url":"https://github.com/Matterhorn-Studios/ReactFBAuth","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Matterhorn-Studios%2FReactFBAuth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Matterhorn-Studios%2FReactFBAuth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Matterhorn-Studios%2FReactFBAuth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Matterhorn-Studios%2FReactFBAuth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Matterhorn-Studios","download_url":"https://codeload.github.com/Matterhorn-Studios/ReactFBAuth/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247305947,"owners_count":20917208,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authentication","firebase","firebase-auth","nextjs","react","typescript"],"created_at":"2024-10-09T03:04:41.049Z","updated_at":"2026-04-12T12:48:20.450Z","avatar_url":"https://github.com/Matterhorn-Studios.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ReactFBAuth\n\nA simple react package ment to make React/NextJS firebase authentication easy.\n\n### Built with Firebase web V9\n\n_currently supports email/password and Google authentication, more will be added soon_\n\n## Setup and Usage\n\n#### Create a Firebase config file\n\nThis file will house your Firebase config as well as auth object and its providers. Config object comes from Firebase console.\n\n```typescript\nimport { initializeApp } from \"firebase/app\";\nimport { getAuth, GoogleAuthProvider } from \"firebase/auth\";\n\nconst firebaseConfig = {\n  apiKey: \"API-KEY\",\n  authDomain: \"EXAMPLE-DOMAIN.firebaseapp.com\",\n  projectId: \"PROJECT-ID\",\n  storageBucket: \"DOMAIN.appspot.com\",\n  messagingSenderId: \"ID\",\n  appId: \"ID\",\n  measurementId: \"ID\",\n};\n\n// Initialize Firebase\nconst app = initializeApp(firebaseConfig);\n\n// init auth\nexport const auth = getAuth(app);\n\n// init google provider\nexport const gProvider = new GoogleAuthProvider();\ngProvider.setCustomParameters({ prompt: \"select_account\" });\n```\n\n#### Add the provider to main\n\nThe provider takes in the auth object, the google provider, and the persistence type (https://firebase.google.com/docs/auth/web/auth-state-persistence).\n\n```typescript\nimport { auth, gProvider } from \"./firebase_client\";\nimport { browserLocalPersistence } from \"firebase/auth\";\n\nReactDOM.createRoot(document.getElementById(\"root\")!).render(\n  \u003cFBAuthProvider\n    fb_auth={auth}\n    g_provider={gProvider}\n    persistence_type={browserLocalPersistence}\n  \u003e\n    \u003cReact.StrictMode\u003e\n      \u003cApp /\u003e\n    \u003c/React.StrictMode\u003e\n  \u003c/FBAuthProvider\u003e\n);\n```\n\n#### Use anywhere\n\nBasic App.tsx example:\n\n```typescript\nimport { useFBAuth } from \"@matterhorn-studios/react-fb-auth\";\n\nfunction App() {\n  const { user, loading, error, googleSignIn, logOut } = useFBAuth();\n\n  if (loading) return \u003ch1\u003eLOADING\u003c/h1\u003e;\n  if (error) return \u003ch1\u003eError: {error.message}\u003c/h1\u003e;\n  return (\n    \u003cdiv\u003e\n      {user ? (\n        \u003c\u003e\n          \u003cdiv\u003e{user.displayName}\u003c/div\u003e\n          \u003cbutton onClick={logOut}\u003elog out\u003c/button\u003e\n        \u003c/\u003e\n      ) : (\n        \u003c\u003e\n          \u003cdiv\u003eno user found\u003c/div\u003e\n          \u003cbutton onClick={googleSignIn}\u003egoogle sign in\u003c/button\u003e\n        \u003c/\u003e\n      )}\n    \u003c/div\u003e\n  );\n}\n\nexport default App;\n```\n\n#### Methods on useFBAuth()\n\n- `googleSignIn` Prompts the user to sign in with google, populates the user, loading, and error object\n- `emailSignIn(email: string, password: string)` Signs the user in with the provided email and password, populates the user, loading, and error object\n- `emailSignUp(email: string, password: string)` Signs the user up with the provided email and password, populates the user, loading, and error object\n- `logOut` Logs the user out\n- `clearError` Clears the error object (resets it to null)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatterhorn-studios%2Freactfbauth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatterhorn-studios%2Freactfbauth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatterhorn-studios%2Freactfbauth/lists"}