@datafire/n_auth v4.0.0
@datafire/n_auth
Client library for nextAuth API
Installation and Usage
npm install --save @datafire/n_authlet n_auth = require('@datafire/n_auth').create({
  api_key: "",
  role_id: ""
});
.then(data => {
  console.log(data);
});Description
API for the nextAuth server
Actions
getApiKeys
Get all API keys generated by the current role. Required permission: global 'servers'.
n_auth.getApiKeys(null, context)Input
This action has no parameters
Output
- output ApiKeys
createApiKey
Create a new API key. Required permission: global 'servers'.
n_auth.createApiKey({
  "description": ""
}, context)Input
- input object- description required string: Description for the new role
 
- description required 
Output
- output ApiKey
deleteGlobalAttributes
Delete all global attributes. Required permission: global 'servers'.
n_auth.deleteGlobalAttributes(null, context)Input
This action has no parameters
Output
Output schema unknown
getGlobalAttributes
Returns an array containing all global attributes. Required permission: global 'servers'.
n_auth.getGlobalAttributes(null, context)Input
This action has no parameters
Output
- output string
setGlobalAttributes
Set the global attributes. Prior attributes with keys that are not provided in the body of the request will be deleted. Required permission: global 'servers'.
n_auth.setGlobalAttributes({
  "attributes": {}
}, context)Input
- input object- attributes required object
 
- attributes required 
Output
Output schema unknown
updateGlobalAttributes
Update the specified global attributes. Prior attributes with keys that are not provided in the body of the request will not be deleted. Required permission: 'servers'.
n_auth.updateGlobalAttributes({
  "attributes": {}
}, context)Input
- input object- attributes required object
 
- attributes required 
Output
Output schema unknown
deleteGlobalAttribute
Delete global attribute with the specified key. Required: global 'servers'.
n_auth.deleteGlobalAttribute({
  "attributekey": ""
}, context)Input
- input object- attributekey required string: Key of the attribute
 
- attributekey required 
Output
Output schema unknown
getServers
List all the servers you have the permissions for. Required permission: 'servers'.
n_auth.getServers({}, context)Input
- input object- limit integer: Limit the number of results
- marker integer: Offset in the result list
 
- limit 
Output
- output Servers
createServer
Create a new server. Required permission: global 'createserver'.
n_auth.createServer({
  "createServerBody": null
}, context)Input
- input object- createServerBody required Server
 
Output
- output Server
getServer
Returns the configuration of a specific server. Required permission: 'servers' or 'createserver'.
n_auth.getServer({
  "serverid": ""
}, context)Input
- input object- serverid required string: Base64 encoded server id
 
- serverid required 
Output
- output Server
updateServer
Update the configuration of a specific server. Required permission: 'createserver'.
n_auth.updateServer({
  "serverid": "",
  "server": null
}, context)Input
- input object- serverid required string: Base64 encoded server id
- server required Server
 
- serverid required 
Output
- output Server
getAllAccounts
Returns all account. Required permission 'accounts'.
n_auth.getAllAccounts({
  "serverid": ""
}, context)Input
- input object- serverid required string: Base64 encoded server id
- filter string: Filter users based on an attribute. Takes the format attributename=attributevalue. You can filter for multiple values at once, e.g. group=in:group1,group2
- limit integer: Limit the number of results
- marker integer: Offset in the result list
- sort string: Sort the results by column. You can also specify ascending (default if not specified) or descending, e.g., column:asc . You can also sort by multiple columns, e.g., column1:desc,column2:asc
 
- serverid required 
Output
- output Accounts
deleteAccount
Delete an account. Required permission: 'accounts'.
n_auth.deleteAccount({
  "serverid": "",
  "accountid": 0
}, context)Input
- input object- serverid required string: Base64 encoded server id
- accountid required integer: Account id
 
- serverid required 
Output
Output schema unknown
getAccount
Returns the account. Required permission: 'sessions' or 'accounts'.
n_auth.getAccount({
  "serverid": "",
  "accountid": 0
}, context)Input
- input object- serverid required string: Base64 encoded server id
- accountid required integer: Account id
 
- serverid required 
Output
- output Account
updateAccount
Update an account. The only available change is (un)blocking the account. Required permission: 'accounts'.
n_auth.updateAccount({
  "serverid": "",
  "accountid": 0,
  "blocked": true
}, context)Input
- input object- serverid required string: Base64 encoded server id
- accountid required integer: Account id
- blocked required boolean: True if the account is blocked
 
- serverid required 
Output
- output Account
provokeLoginOnAccount
Push a login to the nextAuth app for the user to confirm, based on the given account (app instance). Required permission: 'sessions' or 'accounts'.
n_auth.provokeLoginOnAccount({
  "serverid": "",
  "X-nonce": "",
  "accountid": 0
}, context)Input
- input object- serverid required string: Base64 encoded server id
- X-nonce required string: Base64 encoded nonce to identify the browser/webserver session
- accountid required integer: Account id
- userContext UserContext
 
- serverid required 
Output
Output schema unknown
updateAccountUser
Update the user of the given account. Required permission: 'accounts'.
n_auth.updateAccountUser({
  "serverid": "",
  "accountid": 0,
  "userid": ""
}, context)Input
- input object- serverid required string: Base64 encoded server id
- accountid required integer: Account id
- userid required string: User name
 
- serverid required 
Output
- output Account
deleteServerAttributes
Delete all attributes of a specific server. Required permission: 'servers'.
n_auth.deleteServerAttributes({
  "serverid": ""
}, context)Input
- input object- serverid required string: Base64 encoded server id
 
- serverid required 
Output
Output schema unknown
getServerAttributes
Returns an array containing all attributes corresponding to this server. Required permission: 'servers'.
n_auth.getServerAttributes({
  "serverid": ""
}, context)Input
- input object- serverid required string: Base64 encoded server id
 
- serverid required 
Output
- output string
setServerAttributes
Set the attributes of a specific server. Prior attributes with keys that are not provided in the body of the request will be deleted. Required permission: 'servers'.
n_auth.setServerAttributes({
  "serverid": "",
  "attributes": {}
}, context)Input
- input object- serverid required string: Base64 encoded server id
- attributes required object
 
- serverid required 
Output
Output schema unknown
updateServerAttributes
Update the specified attributes of a specific server. Prior attributes with keys that are not provided in the body of the request will not be deleted. Required permission: 'servers'.
n_auth.updateServerAttributes({
  "serverid": "",
  "attributes": {}
}, context)Input
- input object- serverid required string: Base64 encoded server id
- attributes required object
 
- serverid required 
Output
Output schema unknown
deleteServerAttribute
Delete attribute with the specified key of a specific server. Required permission: 'servers'.
n_auth.deleteServerAttribute({
  "serverid": "",
  "attributekey": ""
}, context)Input
- input object- serverid required string: Base64 encoded server id
- attributekey required string: Key of the attribute
 
- serverid required 
Output
Output schema unknown
getAllPermissions
Returns all permissions. Required permission: 'servers'.
n_auth.getAllPermissions({
  "serverid": ""
}, context)Input
- input object- serverid required string: Base64 encoded server id
 
- serverid required 
Output
- output Permissions
revokePermissions
Revoke all permissions for the specified server and role. Required permission: 'root'.
n_auth.revokePermissions({
  "serverid": "",
  "roleid": ""
}, context)Input
- input object- serverid required string: Base64 encoded server id
- roleid required string: Base64 encoded role id
 
- serverid required 
Output
Output schema unknown
getPermissions
Returns all permissions. Required permission: 'servers'.
n_auth.getPermissions({
  "serverid": "",
  "roleid": ""
}, context)Input
- input object- serverid required string: Base64 encoded server id
- roleid required string: Base64 encoded role id
 
- serverid required 
Output
- output Permissions
grantPermissions
Set new permissions for the specified role on a server. This overwrites any existing permissions on this server for the specified role. Required permission: 'root'.
n_auth.grantPermissions({
  "serverid": "",
  "roleid": "",
  "permissions": []
}, context)Input
- input object- serverid required string: Base64 encoded server id
- roleid required string: Base64 encoded role id
- permissions required array- items string
 
- items 
 
- serverid required 
Output
Output schema unknown
deleteServerPrivilegedAttributes
Delete all privileged attributes of a specific server. Required permission: global 'servers'.
n_auth.deleteServerPrivilegedAttributes({
  "serverid": ""
}, context)Input
- input object- serverid required string: Base64 encoded server id
 
- serverid required 
Output
Output schema unknown
getServerPrivilegedAttributes
Returns an array containing all privileged attributes corresponding to this server. Required permission: global 'servers'.
n_auth.getServerPrivilegedAttributes({
  "serverid": ""
}, context)Input
- input object- serverid required string: Base64 encoded server id
 
- serverid required 
Output
- output string
setServerPrivilegedAttributes
Set the privileged attributes of a specific server. Prior attributes with keys that are not provided in the body of the request will be deleted. Required permission: global 'servers'.
n_auth.setServerPrivilegedAttributes({
  "serverid": "",
  "attributes": {}
}, context)Input
- input object- serverid required string: Base64 encoded server id
- attributes required object
 
- serverid required 
Output
Output schema unknown
updateServerPrivilegedAttributes
Update the specified privileged attributes of a specific server. Prior privileged attributes with keys that are not provided in the body of the request will not be deleted. Required permission: global 'servers'.
n_auth.updateServerPrivilegedAttributes({
  "serverid": "",
  "attributes": {}
}, context)Input
- input object- serverid required string: Base64 encoded server id
- attributes required object
 
- serverid required 
Output
Output schema unknown
deleteServerPrivilegedAttribute
Delete privileged attribute with the specified key of a specific server. Required permission: global 'servers'.
n_auth.deleteServerPrivilegedAttribute({
  "serverid": "",
  "attributekey": ""
}, context)Input
- input object- serverid required string: Base64 encoded server id
- attributekey required string: Key of the attribute
 
- serverid required 
Output
Output schema unknown
getSession
Based on the browser/webserver session identifier, check if the user is logged in and return the associated username. This also returns additional information: the data for the login qr code and whether or not a loggin can be provoked directly from the server. Required permission: 'sessions'.
n_auth.getSession({
  "serverid": "",
  "X-nonce": ""
}, context)Input
- input object- serverid required string: Base64 encoded server id
- X-nonce required string: Nonce to identify the browser/webserver session
 
- serverid required 
Output
- output LoginStatus
getHtmlEnrol
Generate HTML to enrol a new user. Required permission: 'sessions'.
n_auth.getHtmlEnrol({
  "serverid": "",
  "X-nonce": ""
}, context)Input
- input object- serverid required string: Base64 encoded server id
- X-nonce required string: Nonce to identify the browser/webserver session
- name string: Name to forward to the nextAuth app for this account
- userid string: User name to register this user under
 
- serverid required 
Output
- output string
getHtmlFooter
HTML to add to footer of HTML page. Required permission: 'sessions'.
n_auth.getHtmlFooter({
  "serverid": "",
  "X-nonce": ""
}, context)Input
- input object- serverid required string: Base64 encoded server id
- X-nonce required string: Nonce to identify the browser/webserver session
- HtmlFooterBody HtmlFooterBody
 
- serverid required 
Output
- output string
getHtmlLogin
Generate HTML for the login block. Required permission: 'sessions'.
n_auth.getHtmlLogin({
  "serverid": "",
  "X-nonce": ""
}, context)Input
- input object- serverid required string: Base64 encoded server id
- X-nonce required string: Nonce to identify the browser/webserver session
- userContext UserContext
 
- serverid required 
Output
- output string
logout
Force a logout on the given session. Required permission: 'sessions'.
n_auth.logout({
  "serverid": "",
  "X-nonce": ""
}, context)Input
- input object- serverid required string: Base64 encoded server id
- X-nonce required string: Nonce to identify the browser/webserver session
 
- serverid required 
Output
Output schema unknown
provokeLogin
Push a login to the nextAuth app for the user to confirm, based on last account that successfully logged in for the given session. Required permission: 'sessions'.
n_auth.provokeLogin({
  "serverid": "",
  "X-nonce": ""
}, context)Input
- input object- serverid required string: Base64 encoded server id
- X-nonce required string: Nonce to identify the browser/webserver session
- userContext UserContext
 
- serverid required 
Output
Output schema unknown
getQrEnrol
Returns the data for an enrol qr code. Required permission: 'sessions'.
n_auth.getQrEnrol({
  "serverid": "",
  "X-nonce": "",
  "name": ""
}, context)Input
- input object- serverid required string: Base64 encoded server id
- X-nonce required string: Nonce to identify the browser/webserver session
- name required string: Name to forward to the nextAuth app for this account
- userid string: User name to register this user under
- img string: 'png' for a PNG image, not set for raw data in the qr code
- s integer: size in pixels of the qr code, defaults to 500
 
- serverid required 
Output
- output file
getQrLogin
Returns the data for a login qr code. Required permission: 'sessions'.
n_auth.getQrLogin({
  "serverid": "",
  "X-nonce": ""
}, context)Input
- input object- serverid required string: Base64 encoded server id
- X-nonce required string: Nonce to identify the browser/webserver session
- img string: "png" for a PNG image, not set for raw data in the qr code
- s integer: size in pixels of the qr code, defaults to 500
- userContext UserContext
 
- serverid required 
Output
- output file
registerUser
Register a user for the currently logged in account. You can also directly pass a user name when generating an ENROL qr code. Required permission: 'users'.
n_auth.registerUser({
  "serverid": "",
  "X-nonce": "",
  "userid": ""
}, context)Input
- input object- serverid required string: Base64 encoded server id
- X-nonce required string: Nonce to identify the browser/webserver session
- userid required string: Username to register
 
- serverid required 
Output
Output schema unknown
createTransaction
Create a transaction for approval within the current session. Required permission: 'sessions'.
n_auth.createTransaction({
  "serverid": "",
  "X-nonce": "",
  "msg": null
}, context)Input
- input object- serverid required string: Base64 encoded server id
- X-nonce required string: Nonce to identify the browser/webserver session
- msg required Transaction
 
- serverid required 
Output
- output TransactionId
getTransactionResult
Get transaction result for a given transaction id. Required permission: 'sessions'.
n_auth.getTransactionResult({
  "serverid": "",
  "transactionid": ""
}, context)Input
- input object- serverid required string: Base64 encoded server id
- transactionid required string: Base64 encoded transaction id
 
- serverid required 
Output
- output TransactionResult
getUsers
Returns an array of arrays containing all accounts corresponding to all users. Required permission: 'users'.
n_auth.getUsers({
  "serverid": ""
}, context)Input
- input object- serverid required string: Base64 encoded server id
- filter string: Filter users based on an attribute. Takes the format attributename=attributevalue. You can filter for multiple values at once, e.g. group=in:group1,group2
- search string: Search for a username LIKE %search%
- limit integer: Limit the number of results
- marker integer: Offset in the result list
- sort string: Sort the results by column. You can also specify ascending (default if not specified) or descending, e.g., column:asc . You can also sort by multiple columns, e.g., column1:desc,column2:asc
 
- serverid required 
Output
- output Users
deleteUser
Delete a user. Required permission: 'users'.
n_auth.deleteUser({
  "serverid": "",
  "userid": ""
}, context)Input
- input object- serverid required string: Base64 encoded server id
- userid required string: User name
 
- serverid required 
Output
Output schema unknown
deleteUserAccounts
Delete all accounts corresponding to this user. The user itself is not deleted. Required permission: 'accounts' or 'users'.
n_auth.deleteUserAccounts({
  "serverid": "",
  "userid": ""
}, context)Input
- input object- serverid required string: Base64 encoded server id
- userid required string: User name
 
- serverid required 
Output
Output schema unknown
getUser
Returns an array containing all accounts corresponding to this user. Required permission: 'sessions' or 'users'.
n_auth.getUser({
  "serverid": "",
  "userid": ""
}, context)Input
- input object- serverid required string: Base64 encoded server id
- userid required string: User name
- limit integer: Limit the number of results
- marker integer: Offset in the result list
- sort string: Sort the results by column. You can also specify ascending (default if not specified) or descending, e.g., column:asc . You can also sort by multiple columns, e.g., column1:desc,column2:asc
 
- serverid required 
Output
- output Accounts
deleteUserAttributes
Delete all attributes of a specific user. Required permission: 'users'.
n_auth.deleteUserAttributes({
  "serverid": "",
  "userid": ""
}, context)Input
- input object- serverid required string: Base64 encoded server id
- userid required string: User name
 
- serverid required 
Output
Output schema unknown
getUserAttributes
Returns an array containing all attributes corresponding to this user. Required permission: 'sessions' or 'users'.
n_auth.getUserAttributes({
  "serverid": "",
  "userid": ""
}, context)Input
- input object- serverid required string: Base64 encoded server id
- userid required string: User name
 
- serverid required 
Output
- output string
setUserAttributes
Set the attributes of a specific user. Prior attributes with keys that are not provided in the body of the request will be deleted. Creates the user if not exists. Required permission: 'users'.
n_auth.setUserAttributes({
  "serverid": "",
  "userid": "",
  "attributes": {}
}, context)Input
- input object- serverid required string: Base64 encoded server id
- userid required string: User name
- attributes required object
 
- serverid required 
Output
Output schema unknown
updateUserAttributes
Update the specified attributes of a specific user. Prior attributes with keys that are not provided in the body of the request will not be deleted. Required permission: 'users'.
n_auth.updateUserAttributes({
  "serverid": "",
  "userid": "",
  "attributes": {}
}, context)Input
- input object- serverid required string: Base64 encoded server id
- userid required string: User name
- attributes required object
 
- serverid required 
Output
Output schema unknown
deleteUserAttribute
Delete attribute with the specified key of a specific user. Required permission: 'users'.
n_auth.deleteUserAttribute({
  "serverid": "",
  "userid": "",
  "attributekey": ""
}, context)Input
- input object- serverid required string: Base64 encoded server id
- userid required string: User name
- attributekey required string: Key of the attribute
 
- serverid required 
Output
Output schema unknown
provokeLoginOnUser
Push a login to the nextAuth app for the user to confirm, based on the given userid. Required permission: 'sessions' or 'users'.
n_auth.provokeLoginOnUser({
  "serverid": "",
  "X-nonce": "",
  "userid": ""
}, context)Input
- input object- serverid required string: Base64 encoded server id
- X-nonce required string: Nonce to identify the browser/webserver session
- userid required string: User name
- userContext UserContext
 
- serverid required 
Output
Output schema unknown
getUserRole
Get role for a specific user. Required permission: 'users'.
n_auth.getUserRole({
  "serverid": "",
  "userid": ""
}, context)Input
- input object- serverid required string: Base64 encoded server id
- userid required string: User name
 
- serverid required 
Output
- output Role
getOrCreateUserRole
Get or create a role for a specific user. Required permission: 'users'.
n_auth.getOrCreateUserRole({
  "serverid": "",
  "userid": ""
}, context)Input
- input object- serverid required string: Base64 encoded server id
- userid required string: User name
 
- serverid required 
Output
- output object- role string
 
- role 
getServerVash
Returns a PNG of the visual hash corresponding to this server. This visual hash is used during the registration process (optional), for the user to verify that (s)he is registering with the right server in the nextAuth app. For single-server nextAuth-enabled apps (white label or mobile SDK), the public key of the server is typically pinned within the app and hence this visual hash is not displayed to the user. Required permission: 'sessions' or 'servers'.
n_auth.getServerVash({
  "serverid": ""
}, context)Input
- input object- serverid required string: Base64 encoded server id
 
- serverid required 
Output
- output file
Definitions
Account
- Account object- blocked boolean: True if the account is blocked, false otherwise
- clientVersion string: Version nextAuth client in the app
- created integer: Timestamp of creation
- description required string: Description of the account (e.g. device name)
- id required integer: Account id
- lastlogin integer: Timestamp of last login
- lastprovoke integer: Timestamp of last provoke (push message)
- userid string: User name
 
- blocked 
Accounts
- Accounts object- accounts required array: Array of accounts- items Account
 
- totalnumber integer: total number of accounts
 
- accounts required 
ApiKey
- ApiKey object- apikey string: API key
- description string: Description
- role string: Role id
 
- apikey 
ApiKeys
- ApiKeys object- apikeys required array: Array of apikeys- items ApiKey
 
 
- apikeys required 
HtmlFooterBody
- HtmlFooterBody object- sessions array- items ServerSession
 
 
- sessions 
LoginStatus
- LoginStatus object- accountid integer: Account id
- canprovoke boolean: True if a login can be pushed from the server, false otherwise
- hsid string: Converted session id, used by the websockets
- loggedin boolean: True if the user is loggedin, false otherwise
- loginqrdata string: Base64 encoded data that is represented in the login qr code
- pk string: Base64 encoded public key of the nextAuth app. This uniquely identifies the account on the nextAuth app, regardless of the username
- userid string: User name
 
- accountid 
Permission
- Permission object- acl string: Comma-seperated list of permissions
- role string: Role id
- server string: Base64 encoded server id
 
- acl 
Permissions
- Permissions object- permissions required array: Array of permissions- items Permission
 
 
- permissions required 
Role
- Role object- role string: Base64 encode role
 
- role 
Server
- Server object- accountCount integer: Number of accounts registered with this server
- appandroid string: URL of the app in Google Play
- appios string: URL of the app in the App Store
- appname string: name of the app
- appurl string: URL (prefix) to launch the app
- lastLogin integer: Last login on this server
- logo required string: Base 64 encoded logo
- owner integer: Owner id
- pinTimeout required integer: Time (minutes) since the last time the user entered his PIN, that the user is not requested a PIN at login. -1 means that the user is never asked for a PIN before logging in, 0 means that the user is asked every time he wants to login
- pinTransTimeout required integer: Time (minutes) since the last time the user entered his PIN, that the user is not requested a PIN at transaction approval. -1 means that the user is never asked for a PIN before approving a transaction, 0 means that the user is asked every time he wants to approve a transaction
- pingTime required integer: Time (seconds) that the nextAuth app has before it needs to reply to a ping request from the nextAuth server (continuous authentication)
- serverFlags required array: Server flags- items string
 
- items 
- serverName required string: Server name
- serverid required string: Base64 encoded id of the nextAuth server
- serverpk required string: Base64 encoded public key of the nextAuth server
- siteurl string: URL of the main website
- wsurl string: Websocket URL
 
- accountCount 
ServerSession
- ServerSession object- serverid required string: Server Id
- sessionid required string: Base64 encoded nonce
 
- serverid required 
Servers
- Servers object- servers required array: Array of servers- items Server
 
- totalnumber integer: total number of users
 
- servers required 
SessionInfo
- SessionInfo object- info object: Information to display to user
- ip string: IP address
- logo string: Base64 encoded logo
- useragent string: User agent of the browser
 
- info 
Transaction
- Transaction object- amount string
- benificiary string
- description string
 
- amount 
TransactionId
- TransactionId object- tid string: Base64 encoded transaction id
 
- tid 
TransactionResult
- TransactionResult object- tstatus string: 0 = new, 1 = approved, 2 = declined
 
- tstatus 
User
- User object- lastlogin integer: (aggregated) last login over all accounts
- numberaccounts integer: (aggregated) number of accounts
- userid required string: User name
 
- lastlogin 
UserContext
- UserContext object- announceinfo SessionInfo
- sessioninfo SessionInfo
 
Users
- Users object- totalnumber integer: total number of users
- users required array: Array of users- items User
 
 
- totalnumber