reazy-auth

0.0.7 • Public • Published

reazy-auth

A simple auth store for your Reazy apps


Installation

1. Using Reazy CLI

$ reazy add auth

2. Manual

  • Install reazy-auth
$ npm install --save reazy-auth
  • Add these lines to your src/app.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:

Let's assume you have registered this service with name auth. Then you can access the service in two ways:

const authService = app.auth;
// OR
const authService = app.get('auth');

This service provides the following functions:

  • setUser(user)

    app.auth.setUser({name: 'Sanket', email: 'sanket@reazyframework.io'});
  • getUser()

    const user = app.auth.getUser();
  • user()

    Alias of getUser

  • setToken(token)

    app.auth.setToken('secret-auth-token');
  • getToken()

    const token = app.auth.getToken();

/reazy-auth/

    Package Sidebar

    Install

    npm i reazy-auth

    Weekly Downloads

    1

    Version

    0.0.7

    License

    Apache-2.0

    Last publish

    Collaborators

    • surajahmedc
    • geekyants-admin
    • sanketsahu
    • sarika_geekyants
    • faizahmed
    • kumarpratik
    • himanshu-geek
    • atulrpandey
    • khalidimam1201
    • gauravp
    • gauravprwl14
    • himanshu-bx
    • akarsh8
    • himanshu-sahusoft