{"id":16512934,"url":"https://github.com/n6g7/rsf-auth","last_synced_at":"2026-04-24T16:33:32.939Z","repository":{"id":57355746,"uuid":"116309520","full_name":"n6g7/rsf-auth","owner":"n6g7","description":"Reducer, actions and sagas to handle authentication with redux-saga-firebase","archived":false,"fork":false,"pushed_at":"2019-11-09T12:38:08.000Z","size":534,"stargazers_count":3,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-14T10:42:46.895Z","etag":null,"topics":["authentication","firebase","redux-saga","redux-saga-firebase"],"latest_commit_sha":null,"homepage":null,"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/n6g7.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}},"created_at":"2018-01-04T21:30:57.000Z","updated_at":"2023-03-07T16:56:42.000Z","dependencies_parsed_at":"2022-09-05T21:30:19.309Z","dependency_job_id":null,"html_url":"https://github.com/n6g7/rsf-auth","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n6g7%2Frsf-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n6g7%2Frsf-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n6g7%2Frsf-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n6g7%2Frsf-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/n6g7","download_url":"https://codeload.github.com/n6g7/rsf-auth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247234861,"owners_count":20905852,"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","redux-saga","redux-saga-firebase"],"created_at":"2024-10-11T16:06:40.211Z","updated_at":"2026-04-24T16:33:32.877Z","avatar_url":"https://github.com/n6g7.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rsf-auth\n\n[![CircleCI](https://circleci.com/gh/n6g7/rsf-auth.svg?style=svg)](https://circleci.com/gh/n6g7/rsf-auth)\n[![npm version](https://badge.fury.io/js/rsf-auth.svg)](https://badge.fury.io/js/rsf-auth)\n[![Coverage Status](https://coveralls.io/repos/github/n6g7/rsf-auth/badge.svg?branch=master)](https://coveralls.io/github/n6g7/rsf-auth?branch=master)\n[![Greenkeeper badge](https://badges.greenkeeper.io/n6g7/rsf-auth.svg)](https://greenkeeper.io/)\n[![Known Vulnerabilities](https://snyk.io/test/github/n6g7/rsf-auth/badge.svg?targetFile=package.json)](https://snyk.io/test/github/n6g7/rsf-auth?targetFile=package.json)\n\nReducer, actions and sagas to handle authentication with [redux-saga-firebase](https://www.npmjs.com/package/redux-saga-firebase).\n\n## Quick start\n\nInstall with:\n\n```js\nyarn add rsf-auth\n```\n\nSetup the authentication reducer:\n\n```js\nimport { combineReducers } from 'redux'\nimport { reducer as auth } from 'rsf-auth'\n\nexport default combineReducers({\n  auth,\n  [...]\n})\n```\n\nStart the authentication saga:\n\n```js\nimport { fork } from 'redux-saga/effects'\nimport { saga as authSaga } from 'rsf-auth'\n\nimport rsf, { authProvider } from '../rsf'\n\nexport default function* rootSaga() {\n  yield fork(authSaga, rsf, authProvider) // 👈 Pass a ReduxSagaFirebase instance and an authProvider to use\n  // [...]\n}\n```\n\nTrigger a login:\n\n```js\nimport { connect } from 'react-redux'\nimport { login } from 'rsf-auth/actions'\n\nconst LoginButton = (login) =\u003e \u003cbutton onClick={login}\u003eLogin\u003c/button\u003e\nexport default connect(null, { login })(LoginButton)\n```\n\nAccess the state with selectors:\n\n```js\nimport { selectors } from 'rsf-auth'\n\n// Build authentication selectors\nconst {\n  loadingSelector,\n  loggedInSelector,\n  userSelector\n} = selectors(state =\u003e state.auth) // 👈 Use the path you chose to store the authentication data in `combineReducers`\n\n// then, given the state:\nuserSelector(state) // a firebase.User instance\n```\n\n## API\n\n### Reducer (`import { reducer } from 'rsf-auth'`)\n\nAn usual `(state, action) =\u003e state` [redux](https://redux.js.org/)-style reducer which stores the authentication data and responds to the authentication actions.\n\n### Saga (`import { saga } from 'rsf-auth'`)\n\nA [redux-saga](https://redux-saga.js.org/) saga which handles login and logout requests as well as user synchronization.\n\nIt takes a ReduxSagaFirebase instance and a Firebase [AuthProvider](https://firebase.google.com/docs/reference/js/firebase.auth.AuthProvider) as arguments.\n\n```js\nimport { saga as auth } from 'rsf-auth'\nimport rsf from './rsf'\n\nconst authProvider = new firebase.auth.GoogleAuthProvider()\n\nfunction* () {\n  yield fork(auth, rsf, authProvider)\n}\n```\n\n### Actions (`import { login, ... } from 'rsf-auth/actions'`)\n\n#### `login()`\nTriggers a login with popup using the AuthProvider passed to the saga.\n\n#### `logout()`\nTriggers a logout.\n\n### Types (`import { types } from 'rsf-auth'`)\n\nObject literal containing all the types used by this library:\n```js\n{\n  LOGIN: {\n    REQUEST: type`LOGIN.REQUEST`,\n    SUCCESS: type`LOGIN.SUCCESS`,\n    FAILURE: type`LOGIN.FAILURE`\n  },\n  LOGOUT: {\n    REQUEST: type`LOGOUT.REQUEST`,\n    SUCCESS: type`LOGOUT.SUCCESS`,\n    FAILURE: type`LOGOUT.FAILURE`\n  },\n  SYNC_USER: type`SYNC_USER`\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fn6g7%2Frsf-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fn6g7%2Frsf-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fn6g7%2Frsf-auth/lists"}