authorization module.
authorize
Kind: inner method of modules/auth
Returns: Promise.<Boolean>
- promise to a boolean. true: authorized, false: not authorized
Param | Type | Description |
---|---|---|
db | Object |
mongodb connection object |
name | String |
the name of the stream / user |
pass | String |
the streams auth key / password |
Example (Example usage of auth function.)
var auth = require('modules/auth/auth');
auth(mongoDB-connection, 'registeredUser', 'supersecurepassword').then(authorized => {
if (!authorized) return 'fail';
return 'allowed';
})