{"id":30180981,"url":"https://github.com/streamich/react-passport","last_synced_at":"2025-08-12T08:06:45.476Z","repository":{"id":41782599,"uuid":"159219480","full_name":"streamich/react-passport","owner":"streamich","description":"React context for client-passport","archived":false,"fork":false,"pushed_at":"2023-12-15T02:35:30.000Z","size":1057,"stargazers_count":8,"open_issues_count":30,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-31T15:59:40.876Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/streamich.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2018-11-26T19:10:10.000Z","updated_at":"2022-02-13T08:51:41.000Z","dependencies_parsed_at":"2024-02-05T10:15:04.259Z","dependency_job_id":null,"html_url":"https://github.com/streamich/react-passport","commit_stats":{"total_commits":14,"total_committers":3,"mean_commits":4.666666666666667,"dds":0.2142857142857143,"last_synced_commit":"85bae11fb3c471dd50d140ea1f9d5c23d89511ce"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/streamich/react-passport","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Freact-passport","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Freact-passport/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Freact-passport/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Freact-passport/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/streamich","download_url":"https://codeload.github.com/streamich/react-passport/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Freact-passport/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270024697,"owners_count":24514054,"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","status":"online","status_checked_at":"2025-08-12T02:00:09.011Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-08-12T08:06:23.335Z","updated_at":"2025-08-12T08:06:45.461Z","avatar_url":"https://github.com/streamich.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-passport\n\n- Client-side authentication for React\n- React context for [`client-passport`](https://github.com/streamich/client-passport)\n- Provides Hooks API\n\n\n## Installation\n\nInstal `react-passport` and `client-passport` packages.\n\n```shell\nyarn add client-passport react-passport\n```\n\n\n## Usage\n\nFirst create an `authenticator` instance.\n\n```js\nimport {passport} from 'client-passport';\nimport {loader as googleLoader} from 'client-passport/lib/providers/google';\nimport {loader as facebookLoader} from 'client-passport/lib/providers/facebook';\n\nconst authenticator = passport({\n  providers: {\n    google: async () =\u003e ({\n      loader: googleLoader,\n      options: {\n        client_id: '305188012168-htfit0k0u4vegn0f6hn10rcqoj1m77ca.apps.googleusercontent.com',\n      },\n    }),\n    facebook: () =\u003e ({\n      loader: facebookLoader,\n      options: {\n        appId: '253302651812049',\n        autoLogAppEvents: true,\n        xfbml: true,\n        version: 'v3.2',\n      }\n    }),\n  }\n});\n```\n\nNow use `react-passport` to create React context.\n\n```js\nimport createAuthenticatorContext from 'react-passport';\nconst {Provider, Consumer, context, useAuth} = createAuthenticatorContext(authenticator);\n```\n\nNow you can use it as React context.\n\n```jsx\n\u003cProvider\u003e\n  \u003cConsumer\u003e{({loading, user, auth}) =\u003e {\n    // ...\n  }}\u003c/Consumer\u003e\n\u003c/Provider\u003e\n```\n\nWhere\n\n- `loading` \u0026mdash; is a boolean indicating whether `authenticator` itself is loading.\n- `auth` \u0026mdash; is the instance of `authenticator`, you can use it for signing in/out `auth.signIn('google')` and `auth.signOut()`.\n- `user` \u0026mdash; is `null` if user is not authenticated or an instance of `User` object if user is authenticated. You can use it as `user.name`, `user.avatar`, `user.token` etc.\n\nYou can also use this library with React hooks.\n\n```js\nconst MyComponent = () =\u003e {\n  const {loading, user, auth} = useAuth();\n  // ...\n};\n```\n\n\n## License\n\n[Unlicense](LICENSE) \u0026mdash; public domain.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreamich%2Freact-passport","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstreamich%2Freact-passport","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreamich%2Freact-passport/lists"}