# reazy-auth

> A simple authentication module for your Reazy application.

Latest version **0.0.7** (published 2017-02-27) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install reazy-auth
pnpm add reazy-auth
yarn add reazy-auth
bun add reazy-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.0.7 |
| Published | 2017-02-27 |
| First published | 2017-01-05 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 4 |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Kumar Sanket, Himanshu Satija, Sankhadeep Roy |
| Maintainers | geekyants, himanshu-sahusoft |
| Keywords | reazy, reazy-auth, react, native, framework |

## Links

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

## Dependencies (3)

- [chalk](https://npm.io/package/chalk.md) ^1.1.1
- [yeoman-generator](https://npm.io/package/yeoman-generator.md) ^0.24.1
- [reazy-setup-helper](https://npm.io/package/reazy-setup-helper.md) ^0.0.5

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.0.7 (latest) — 2017-02-27
- 0.0.6 — 2017-02-27
- 0.0.5 — 2017-02-27
- 0.0.4 — 2017-02-15
- 0.0.3 — 2017-02-14
- 0.0.2 — 2017-01-05
- 0.0.1 — 2017-01-05

## README

# reazy-auth
### A simple auth store for your Reazy apps

---

## Installation

### 1. Using [Reazy CLI](https://www.npmjs.com/package/reazy-cli)

  ```sh
  $ reazy add auth
  ```

### 2. Manual

  - Install `reazy-auth`
  ```sh
  $ npm install --save reazy-auth
  ```

  - Add these lines to your `src/app.js`.
  ```js
  import reazy from 'reazy';
  import auth from 'reazy-auth';                    // <-- import the service
  import reactNative from './services/react-native';

  const app = reazy();

  app.use(auth(), 'auth');                          // <-- Initialize the service
  app.use(reactNative(), 'reactNative');

  export default app;
  ```

## Usage

This Reazy plugin is just an authentication store service. For full implementation of authentication, use this with one of the following:
- [reazy-auth-jwt](https://www.npmjs.com/package/reazy-auth-jwt)
- [reazy-native-auth-facebook](https://www.npmjs.com/package/reazy-native-auth-facebook)

Let's assume you have registered this service with name `auth`. Then you can access the service in two ways:
```js
const authService = app.auth;
// OR
const authService = app.get('auth');
```

This service provides the following functions:

- **setUser(user)**
  ```js
  app.auth.setUser({name: 'Sanket', email: 'sanket@reazyframework.io'});
  ```

- **getUser()**
  ```js
  const user = app.auth.getUser();
  ```

- **user()**

  Alias of `getUser`

- **setToken(token)**
  ```js
  app.auth.setToken('secret-auth-token');
  ```

- **getToken()**
  ```js
  const token = app.auth.getToken();
  ```

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