authrocket-node
v0.2.0
Published
Library for interfacing with AuthRocket service on server-side (Node.js).
Downloads
11
Maintainers
Readme
AuthRocket
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:
list
method of all entities added (not supported before).- webpack removed, right now library not compiled to 1 big file with all dependencies, which is better on server-side.
superagent
package removed, instead of thisrequest-promise
added, which is powerful on server-side.generatePasswordToken
andresetPasswordWithToken
methods added to Usersreset
method added to RealmsJwtKeys
APIs added.- Bug with
Sessions
url fixed - Server-side authentication (without LoginRocket) by password and by token added
Getting Started
- Install through npm:
npm install --save authrocket
- 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>
-->
- 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 entitiesget
- return a entityadd
- create a new entityupdate
- update a entityremove
- 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