{"id":13793516,"url":"https://github.com/lukejacksonn/hyperapp-firebase-auth","last_synced_at":"2025-04-12T03:31:55.317Z","repository":{"id":149248869,"uuid":"101943424","full_name":"lukejacksonn/hyperapp-firebase-auth","owner":"lukejacksonn","description":":fire: Drop in authentication for hyperapps using firebase","archived":false,"fork":false,"pushed_at":"2018-03-13T22:48:51.000Z","size":18,"stargazers_count":19,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-10T08:05:46.175Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://codepen.io/lukejacksonn/pen/xLBJoN","language":"JavaScript","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/lukejacksonn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-31T01:00:40.000Z","updated_at":"2022-11-21T19:50:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"91363a0b-a3bb-4918-bf64-2e96a84d5509","html_url":"https://github.com/lukejacksonn/hyperapp-firebase-auth","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/lukejacksonn%2Fhyperapp-firebase-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukejacksonn%2Fhyperapp-firebase-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukejacksonn%2Fhyperapp-firebase-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukejacksonn%2Fhyperapp-firebase-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukejacksonn","download_url":"https://codeload.github.com/lukejacksonn/hyperapp-firebase-auth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248512790,"owners_count":21116680,"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":[],"created_at":"2024-08-03T23:00:23.039Z","updated_at":"2025-04-12T03:31:54.980Z","avatar_url":"https://github.com/lukejacksonn.png","language":"JavaScript","readme":"# hyperapp-firebase-auth\n\n\u003e Drop in firebase authentication for hyperapps\n\n![ezgif com-gif-maker](https://user-images.githubusercontent.com/1457604/29901861-6cf8c5d4-8df2-11e7-9611-e2800e7bde96.gif)\n\nThis project exports a [hyperapp](https://github.com/hyperapp/hyperapp) module (state/actions/view) that wraps the [Firebase authentication API](https://firebase.google.com/docs/auth/). It manages the application state and renders appropriate views for the authentication flows `Sign In` and `Create User`.\n\n**DEMO:** https://codepen.io/lukejacksonn/pen/xLBJoN\n\nOut of the box features include:\n\n- No server setup or backend code\n- Human readable error messages\n- Email validation and confirmation\n- Reset password by email\n\n## Usage\n\n\u003e If you have not already initialized firebase on your frontend see [Firebase Setup](#firebase-setup)\n\nInstall the package from npm or include from [CDN](https://unpkg.com/hyperapp-firebase-auth):\n\n```\nnpm i hyperapp-firebase-auth\n```\n\nImport the module `firebaseAuth` and the `FirebaseAuthDialog` view:\n\n```js\nimport { app, h } from 'hyperapp'\nimport { firebaseAuth, FirebaseAuthDialog } from 'hyperapp-firebase-auth'\n\nconst main =\n  app(\n    { auth: firebaseAuth.state },\n    { auth: firebaseAuth.actions },\n    (state, actions) =\u003e\n      h('main', {}, [\n        // Only shows when NOT authenticated\n        FirebaseAuthDialog(state.auth, actions.auth),\n        // Only shows when authenticated\n        state.auth.authed \u0026\u0026 `Hello ${state.auth.user.uid}!`\n      ]),\n    document.body\n  )\n\nfirebase.auth().onAuthStateChanged(main.auth.userChanged)\n```\n\n\n## How it works\n\n- An empty element is rendered until an auth status is received from Firebase\n- If the auth status is null then the user is prompted to enter their email address\n  - Existing users are then prompted to enter their password to sign in\n  - New users are prompted to confirm their email address and set a password to sign up\n- The dialog will not be rendered once auth status returns a valid Firebase user\n\n\n## Firebase Setup\n\nIf you want to use Firebase Authentication for your own apps then you will need to create a Firebase Account and create a new project. This can be done for **free** at https://console.firebase.google.com.\n\n\u003e If you don't want to create your own project then you can use the example config below\n\nOnce you have created a project you will be presented with an app configuration like this:\n\n```html\n\u003cscript src=\"https://www.gstatic.com/firebasejs/4.3.0/firebase.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  var config = {\n    apiKey: \"AIzaSyBKRtxwj3SrSZdlKs4x5CeFm4zxymv6JDU\",\n    authDomain: \"hyperapp-497ce.firebaseapp.com\",\n    databaseURL: \"https://hyperapp-497ce.firebaseio.com\",\n    projectId: \"hyperapp-497ce\",\n    storageBucket: \"hyperapp-497ce.appspot.com\",\n    messagingSenderId: \"458459404992\"\n  };\n  firebase.initializeApp(config);\n\u003c/script\u003e\n```\n\nAdd this snippet to your `index.html` **before** any of your hyperapp application code. This ensures that the Firebase API exists when the module loads. Once you are setup, visit the link below (replacing `${projectId}` with the projectId from your newly created Firebase project config) and `Enable` the `Email/Password` provider.\n\n```\nhttps://console.firebase.google.com/project/${projectId}/authentication/providers\n```\n\nThat is all the back and front end configuration you need to do.\n","funding_links":[],"categories":["Utilities V1"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukejacksonn%2Fhyperapp-firebase-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukejacksonn%2Fhyperapp-firebase-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukejacksonn%2Fhyperapp-firebase-auth/lists"}