0.2.0 • Published 5 years ago

authrocket-node v0.2.0

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

AuthRocket

NPM version NPM downloads Build Status Dependency Status Code Climate Code Coverage License Code Style

NodeJS library for interfacing with Auth Rocket.

Why Not Use AuthRocket's authrocket.js?

Authrocket.js requires including jQuery and is therefore not a useful solution for running on NodeJS or within a front end project that doesn't use jQuery. Also, the API for the default AuthRocket library only provides methods for LoginRocket actions as it is for client side usage only.

Warning: Not officially supported by Auth Rocket.

Docs Page

About this package

First, this is fork of another package authrocket, original package can be used without problems only on client-side (in browser), due to XMLHttpRequest dependency. Code changed, to work on server-side. Also some improvements added.

####Changes over original package: 1. list method of all entities added (not supported before). 2. webpack removed, right now library not compiled to 1 big file with all dependencies, which is better on server-side. 3. superagent package removed, instead of this request-promise added, which is powerful on server-side. 4. generatePasswordToken and resetPasswordWithToken methods added to Users 5. reset method added to Realms 6. JwtKeys APIs added. 7. Bug with Sessions url fixed 8. Server-side authentication (without LoginRocket) by password and by token added

Getting Started

  1. Install through npm: npm install --save authrocket
  2. Import AuthRocket:

    NodeJS

    var AuthRocket = require('authrocket');

    ES6

    import AuthRocket from 'authrocket';

    Browser

    <script src="node_modules/authrocket/dist/authrocket.js"></script>
    <!--
    Also available through CDN using:
    <script src="http://cdn.prue.io/authrocket/latest/authrocket.js"></script>
    -->
  3. Create a new AuthRocket instance:

//Create new authrocket instance with authrocket.js URL
var authrocket = new AuthRocket({jsUrl: 'https://zzzzzzzzz.e1.loginrocket.com/v1/'});

Supporting entities

List of supporting entities:

  • Realms
  • Users
  • Credentials
  • SignupTokens
  • Orgs
  • Memberships
  • AuthProviders
  • ConnectedApps
  • Hooks
  • Sessions
  • Events
  • Notifications
  • JwtKeys

All this entities has methods:

  • list - return a list of entities
  • get - return a entity
  • add - create a new entity
  • update - update a entity
  • remove - remove a entity

Configuration

Config variables can be set when you are creating your AuthRocket instance or through environment variables. Using environment variables is suggested for variables that should be kept private, such as your JWT secret.

LoginRocket capabilities (Login/Logout/Signup)

authrocket.js URL

Options Variable: jsUrl

Environment Variable: AUTHROCKET_JS_URL

Management Functionality (usually server side)

Account ID

Options Variable: accountId

Environment Variable: AUTHROCKET_ACCOUNT_ID

API key

Options Variable: apiKey

Environment Variable: AUTHROCKET_API_KEY

Realm Id

Options Variable: realmId

Environment Variable: AUTHROCKET_REALM_ID

API URL

Options Variable: apiUrl

Environment Variable: AUTHROCKET_API_URL

Other vars

JWT Secret

Options Variable: jwtSecret

Environment Variable: AUTHROCKET_JWT_SECRET

0.2.0

5 years ago

0.1.9

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.9

5 years ago