1.2.0 • Published 3 years ago

patricia-auth-client v1.2.0

Weekly downloads
6
License
MIT
Repository
github
Last release
3 years ago

Installation Guide

Using npm: Dependencies

$ npm install dotenv knex uuid mysql --save

Env file

In your root directory create a .env file OR Run command:

$ touch .env

Add the following content and update with the correct informations

CLIENT_DB_CONNECTION=mysql
CLIENT_DB_HOST=127.0.0.1
CLIENT_DB_PORT=3306
CLIENT_DB_DATABASE=your_db_name
CLIENT_DB_USERNAME=your_username
CLIENT_DB_PASSWORD=your_password

COMMAND

  • Run The Following Commands

Generate Migration Files

  • Run
$ patricia-auth-init

Run Migrations but ensure you have the .env files are correct database details.

  • Run

Before migration runs check that .env data are correct.

$ patricia-auth-migrate

Avalable Methods

  create(name), 
  update_client(uuid, name),
  get_client(uuid),
  get_client_keys(id),
  delete_client(uuid),
  is_authenticate(apikey),
  create_client_keys(uuid),
  delete_client_keys(id),
  update_client_key(id),
  block_client_key(id),
  unblock_client_key(id),
  block_client(uuid),
  unblock_client(uuid),
  is_admin(uuid),

if type is admin use create(name, type='admin'),

Avalable Helpers

  is_admin(uuid),
  is_authenticate(apikey),

Happy coding!