# react-jwt-auth

> JSON Web Token authentication and authorization component for React

Latest version **0.6.0** (published 2016-10-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-jwt-auth
pnpm add react-jwt-auth
yarn add react-jwt-auth
bun add react-jwt-auth
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.6.0 |
| Published | 2016-10-28 |
| First published | 2016-10-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 20 |
| Maintainers | fullstackforger |
| Keywords | react, auth, jwt, authentication, token, component |

## Links

- npm: https://www.npmjs.com/package/react-jwt-auth
- Repository: https://github.com/fullstackforger/react-jwt-auth
- Homepage: https://github.com/fullstackforger/react-jwt-auth#readme
- Issues: https://github.com/fullstackforger/react-jwt-auth/issues
- npm.io page: https://npm.io/package/react-jwt-auth

## Dependencies (1)

- [enverse](https://npm.io/package/enverse.md) ^0.2.3

## 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

- 0.6.0 (latest) — 2016-10-28
- 0.5.12 — 2016-10-28
- 0.5.11 — 2016-10-27
- 0.5.10 — 2016-10-24
- 0.5.9 — 2016-10-24
- 0.5.8 — 2016-10-22
- 0.5.6 — 2016-10-22
- 0.5.5 — 2016-10-22
- 0.5.3 — 2016-10-22
- 0.5.2 — 2016-10-22
- 0.5.1 — 2016-10-22
- 0.5.0 — 2016-10-14
- 0.4.2 — 2016-10-13
- 0.4.1 — 2016-10-13
- 0.4.0 — 2016-10-13
- … 2 more at https://npm.io/package/react-jwt-auth/versions

## README

# React JWT Auth

### Token based authentication for react.

[![Build Status](https://travis-ci.org/fullstackforger/react-jwt-auth.svg?branch=master)](https://travis-ci.org/fullstackforger/react-jwt-auth)
[![Coverage Status](https://coveralls.io/repos/github/fullstackforger/react-jwt-auth/badge.svg?branch=master)](https://coveralls.io/github/fullstackforger/react-jwt-auth?branch=master)
[![Code Climate](https://codeclimate.com/github/fullstackforger/react-jwt-auth/badges/gpa.svg)](https://codeclimate.com/github/fullstackforger/react-jwt-auth)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/4d2136784d334d7f8f4178c7b979d9f2)](https://www.codacy.com/app/fullstackforger/react-jwt-auth?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=fullstackforger/react-jwt-auth&amp;utm_campaign=Badge_Grade)
[![npm](https://img.shields.io/npm/v/react-jwt-auth.svg)](https://www.npmjs.com/package/react-jwt-auth)  
[![dependencies Status](https://david-dm.org/fullstackforger/react-jwt-auth/status.svg)](https://david-dm.org/fullstackforger/react-jwt-auth)
[![devDependencies Status](https://david-dm.org/fullstackforger/react-jwt-auth/dev-status.svg)](https://david-dm.org/fullstackforger/react-jwt-auth?type=dev)
[![peerDependencies Status](https://david-dm.org/fullstackforger/react-jwt-auth/peer-status.svg)](https://david-dm.org/fullstackforger/react-jwt-auth?type=peer)

> **Work in progress. Contributions are welcomed!**

## Inspiration

Satellizer, for its simplicity, clear code and maturity was initial source of inspiration. 
As there is no need to reinvent the wheel, some of Satellizer code has been reused where possible and adopted to React.

## Setup

Before you start using component you should configure it, eg:
```
ReactDOM.render(
	<Auth baseUrl="http://localhost:8080/api/">
		<YourAwesomeComponents />
	</Auth>,
	document.getElementById('app')
);
```

More in docs, [configuration](./docs/configuration.md) section. 

## Social buttons

Here is simplest example of social buttons in use inside of your component `reder()` method.

```
render () {
	return (
		<div className="form-group">
			<Facebook clientId="310178806023492" />
			<Google clientId="389760969675-u3h2dgm1v3lqd22u8aloimkgd10i0rvf.apps.googleusercontent.com"	/>
		</div>
	)
}
```

## Testing

You can run all tests with:
```
npm test
```

### Test coverage

We run test coverage with [nyc](https://www.npmjs.com/package/nyc) and [here][nyc-why] is why.
[nyc-why]: http://stackoverflow.com/a/33725069/6096446)

You can run test coverage task locally with:
```
npm run test:coverage
```
It will:
* run all tests
* generate coverage data
* create coverage report files in `./coverage` folder
* check minimum coverage requirements set to 95%

Additionally we use [coveralls.io](https://coveralls.io/) for coverage badge generation.
[![Coverage Status](https://coveralls.io/repos/github/fullstackforger/react-jwt-auth/badge.svg?branch=master)](https://coveralls.io/github/fullstackforger/react-jwt-auth?branch=master)

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