0.3.4 • Published 6 years ago

@xanthous/auth v0.3.4

Weekly downloads
-
License
ISC
Repository
-
Last release
6 years ago

Auth Module

Instalation

yarn add @xanthous/auth

Backend

for dublicate default providers.js

cp node_modules/@xanthous/auth/providers.js /path/to/backend

and add this to directory into your server/model-config.json

  "_meta": {
    "sources": [
      "../node_modules/@xanthous/auth/build/models",
      "../node_modules/@xanthous/auth/node_modules/loopback-component-passport/lib/models",
    ],
    "mixins": [
    ]
  },

and add this in models

"user": {
  "dataSource": "db",
  "public": true
},
"accessToken": {
  "dataSource": "db",
  "public": false
},
"userCredential": {
  "dataSource": "db",
  "public": false
},
"userIdentity": {
  "dataSource": "db",
  "public": false
},

add this to server/server.js

const { configurator: authConfigurator } = require('@xanthous/auth');

/*
   ...
   ..
   .

   after boot script

*/
authConfigurator(app, {
  providersConfig: require('./auth-providers'),
  sessionSecret: 'XXXXX',
});

if you don't want to use default userIdentity , userCredentia and access-token

cp -r node_modules/@xanthous/auth/models/* path/to/backend/common/models/

FrontEnd

add to reducers.js

import auth from '@xanthous/auth/build/reducer'
export default combineReducers({
  auth,
  ...
  ...
});

when you wanna use the functions

import { login } from '@xanthous/auth/build/reducer'


function mapDispatchToProps(dispatch) {
  return {
    login: (credentials) => dispatch(login(credentials))
  };
}

Avaible methods.

  signup
  login
  loginWithFacebook
  loginWithGoogle
  logout
0.3.4

6 years ago

0.3.3

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.24

6 years ago

0.1.23

6 years ago

0.1.22

6 years ago

0.1.21

6 years ago

0.1.20

6 years ago

0.1.19

6 years ago

0.1.18

6 years ago

0.1.17

6 years ago

0.1.16

6 years ago

0.1.15

6 years ago

0.1.14

6 years ago

0.1.13

6 years ago

0.1.12

6 years ago

0.1.11

6 years ago

0.1.10

6 years ago

0.1.8

6 years ago

0.1.5

6 years ago

0.0.7

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago