# react-router-firebase-auth-guard

> A Package For Managing React-Router Firebase Auth Guard

Latest version **1.1.0** (published 2017-11-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-router-firebase-auth-guard
pnpm add react-router-firebase-auth-guard
yarn add react-router-firebase-auth-guard
bun add react-router-firebase-auth-guard
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2017-11-05 |
| First published | 2017-11-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ghulam Mustafa Raza Qadri |
| Maintainers | ghulammustafaraza |
| Keywords | auth, firebase, react, react-router, react-router-dom, guard, solution |

## Links

- npm: https://www.npmjs.com/package/react-router-firebase-auth-guard
- Repository: https://github.com/ghulamMustafaRaza/react-router-firebase-auth-guard
- Homepage: https://github.com/ghulamMustafaRaza/react-router-firebase-auth-guard#readme
- Issues: https://github.com/ghulamMustafaRaza/react-router-firebase-auth-guard/issues
- npm.io page: https://npm.io/package/react-router-firebase-auth-guard

## Dependencies (4)

- [react](https://npm.io/package/react.md) ^16.0.0
- [firebase](https://npm.io/package/firebase.md) ^4.6.1
- [react-dom](https://npm.io/package/react-dom.md) ^16.0.0
- [react-router-dom](https://npm.io/package/react-router-dom.md) ^4.2.2

## Alternatives

- [@clerk/clerk-expo](https://npm.io/package/@clerk/clerk-expo.md) — 133.6K weekly downloads
- [@pothos/plugin-authz](https://npm.io/package/@pothos/plugin-authz.md) — 12.4K weekly downloads
- [@bounded-sh/client](https://npm.io/package/@bounded-sh/client.md) — 3.2K weekly downloads
- [@luigi-project/plugin-auth-oauth2](https://npm.io/package/@luigi-project/plugin-auth-oauth2.md) — 2.3K weekly downloads
- [@nocobase/plugin-verification](https://npm.io/package/@nocobase/plugin-verification.md) — 2.0K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2017-11-05
- 1.0.4 — 2017-11-05

## README

# react-router-firebase-auth-guard
A Package For Managing React-Router Firebase Auth Guard 
<br/>

## Installing Required Packages

```sh
npm install --save firebase react-router-dom
```
OR

```sh
yarn add firebase react-router-dom
```

## Installing Package

```sh
npm install --save react-router-firebase-auth-guard
```
OR

```sh
yarn add react-router-firebase-auth-guard
```

## Usage

<br/>

```jsx
import { initializeApp } from 'firebase';
import React from 'react';
import ReactDOM from 'react-dom';
import { FirebaseAuthGuardRouter, FirebaseAuthGuardRoute } from 'react-router-firebase-auth-guard';
import {
    Link
} from 'react-router-dom'

// COPIED FROM YOUR FIREBASE PROJECT
var config = {
    apiKey: "<API_KEY>",
    authDomain: "<AUTH_DOMAIN>",
    databaseURL: "BASE_URL",
    projectId: "PROJECT_ID"
};

initializeApp(config);

const NavBar = ({ auth }) => (
    <div>
        react-router-firebase-auth-guard
        {auth ?
            <ul style={{ display: 'flex' }}>
                <li><Link to="/">Nutral</Link></li>
                <li><Link to="/auth">Auth Required</Link></li>
            </ul>
            :
            <ul style={{ display: 'flex' }}>
                <li><Link to="/">Nutral</Link></li>
                <li><Link to="/noauth">noAuth Required</Link></li>
            </ul>
        }
    </div>
)
ReactDOM.render(
    <div>
        <FirebaseAuthGuardRouter loading={<span>loading...</span>} navBar={NavBar}>
            <FirebaseAuthGuardRoute exact path="/" component={() => <h1>Nutral</h1>} />
            <FirebaseAuthGuardRoute noAuthOnly exact redirectPath="/noauth" path="/auth" component={() => <h1>auth</h1>} />
            <FirebaseAuthGuardRoute authOnly redirectPath="/auth" path="/noauth" component={() => <h1>no auth</h1>} />
        </FirebaseAuthGuardRouter>
    </div>,
    document.getElementById('root') // ROOT IS MY ID PASTE HERE YOURS
);
```

<br/>

---
_Source: https://npm.io/package/react-router-firebase-auth-guard · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
