{"_id":"brauth","_rev":"36-fef6a4b47440b24e98a922af572c7647","name":"brauth","description":"Bold Rocket Authentication module","dist-tags":{"latest":"0.0.7"},"versions":{"0.0.0":{"name":"brauth","version":"0.0.0","description":"Bold Rocket Authentication module","main":"index.js","scripts":{"test":"for f in tests/*; do echo \"$f\"; node \"$f\"; done; echo 'passed!'; exit 0"},"repository":{"type":"git","url":"https://github.com/atheohar/brauth.git"},"keywords":["npm","module","brauth"],"author":{"name":"Antonis Theocharides"},"license":"BSD","gitHead":"8a3574d1d1792c533ae266dbf42d50070d449744","bugs":{"url":"https://github.com/atheohar/brauth/issues"},"_id":"brauth@0.0.0","dist":{"shasum":"2dc1ff4bfc175e2d175610c126a0c131c555bc91","tarball":"https://registry.npmjs.org/brauth/-/brauth-0.0.0.tgz","integrity":"sha512-q5Jd0hWyka4IjTV+9k0U2CkKPpsb70Qj7dNGXGN939FVXdriTdIQI+tEBJ/qVXOiwCIzQhoZpesOhNQj6rmnXg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGwiquHp60aLrZtJDnPjB++OY55jVnnG9NCaA3//M3v9AiEAkEm2gIwmTjZoZ2Sn9Up/t0aa83G5uXoFvnaZwCfLFdA="}]},"_from":".","_npmVersion":"1.2.30","_npmUser":{"name":"atheohar","email":"atheohar@gmail.com"},"maintainers":[{"name":"atheohar","email":"atheohar@gmail.com"}]},"0.0.1":{"name":"brauth","version":"0.0.1","description":"Bold Rocket Authentication module","main":"index.js","scripts":{"test":"for f in tests/*; do echo \"$f\"; node \"$f\"; done; echo 'passed!'; exit 0"},"repository":{"type":"git","url":"https://github.com/atheohar/brauth.git"},"keywords":["npm","module","brauth"],"author":{"name":"Antonis Theocharides"},"license":"BSD","gitHead":"8a3574d1d1792c533ae266dbf42d50070d449744","bugs":{"url":"https://github.com/atheohar/brauth/issues"},"_id":"brauth@0.0.1","dist":{"shasum":"f2306eec97b2b40e74769af9c5baa5551db74b44","tarball":"https://registry.npmjs.org/brauth/-/brauth-0.0.1.tgz","integrity":"sha512-MlXsR/uEeTZl/FS1Ayb35WeNNP36U6FqpA2eaKIbMfV0CluPjs+JPBogvWlfKy4MwJ2vGpB3U7A3CPBeMmkdGA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDcrfR1J2RocaZ/4hWVKs4MxmzvCQ+n+WpNkD/2b/Dq3AIgNECeyfl4jiG5st9Mgy/dlYZ/NA9nM6t7+VSBogUuJuw="}]},"_from":".","_npmVersion":"1.2.30","_npmUser":{"name":"atheohar","email":"atheohar@gmail.com"},"maintainers":[{"name":"atheohar","email":"atheohar@gmail.com"}]},"0.0.2":{"name":"brauth","version":"0.0.2","description":"Bold Rocket Authentication module","main":"index.js","scripts":{"test":"for f in tests/*; do echo \"$f\"; node \"$f\"; done; echo 'passed!'; exit 0"},"repository":{"type":"git","url":"https://github.com/atheohar/brauth.git"},"keywords":["npm","module","brauth"],"author":{"name":"Antonis Theocharides"},"license":"BSD","gitHead":"8a3574d1d1792c533ae266dbf42d50070d449744","bugs":{"url":"https://github.com/atheohar/brauth/issues"},"_id":"brauth@0.0.2","dist":{"shasum":"1bc06e062d031bf6b7907d01f6a67dda525c6820","tarball":"https://registry.npmjs.org/brauth/-/brauth-0.0.2.tgz","integrity":"sha512-A5BDombOL28QRmKwtwxa+jFIFWjWjyw3x4BC6r1EH4nK4+Ws3zMhwMUJVvBhh2FQ7oN/MYFxGv9BnSpnIIrAnw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIE8/T50fyrCmXaXWkziKio9DD96myMvUETIU9KPFZ9MwAiBYI0VHBO1c/4xdSeulRkT+jHIiyyEz1bFOwPNsHhHBLg=="}]},"_from":".","_npmVersion":"1.2.30","_npmUser":{"name":"atheohar","email":"atheohar@gmail.com"},"maintainers":[{"name":"atheohar","email":"atheohar@gmail.com"}]},"0.0.3":{"name":"brauth","version":"0.0.3","description":"Bold Rocket Authentication module","main":"index.js","scripts":{"test":"for f in tests/*; do echo \"$f\"; node \"$f\"; done; echo 'passed!'; exit 0"},"dependencies":{"bcrypt-nodejs":"~0.0.3","node-rest-client":"~0.8.0","form-data":"~0.1.2","request":"~2.34.0"},"repository":{"type":"git","url":"https://github.com/atheohar/brauth.git"},"keywords":["npm","module","brauth"],"author":{"name":"Antonis Theocharides"},"license":"BSD","gitHead":"8a3574d1d1792c533ae266dbf42d50070d449744","bugs":{"url":"https://github.com/atheohar/brauth/issues"},"_id":"brauth@0.0.3","dist":{"shasum":"362df21035db4db6e32882c3a4938844700861be","tarball":"https://registry.npmjs.org/brauth/-/brauth-0.0.3.tgz","integrity":"sha512-5VOroJDoYbHiM9gs9n9Av6AvbxeysE8ZJ6vAO2DSFOgVPY9RMLe4iXs4oF7UqNutyvNYilLwbZrHOItJ8uDeIA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC0pGCxUsrK5ZhxMn0TimgyRYjlf+qOCRkvOPbPqE0EDQIhAP3NXT+V49mMo0AwC+sEj3a3wP/EHETtBXmnkKfVZlib"}]},"_from":".","_npmVersion":"1.2.30","_npmUser":{"name":"atheohar","email":"atheohar@gmail.com"},"maintainers":[{"name":"atheohar","email":"atheohar@gmail.com"}]},"0.0.4":{"name":"brauth","version":"0.0.4","description":"Bold Rocket Authentication module","main":"index.js","scripts":{"test":"for f in tests/*; do echo \"$f\"; node \"$f\"; done; echo 'passed!'; exit 0"},"dependencies":{"bcrypt-nodejs":"~0.0.3","node-rest-client":"~0.8.0","form-data":"~0.1.2","request":"~2.34.0"},"repository":{"type":"git","url":"https://github.com/atheohar/brauth.git"},"keywords":["npm","module","brauth"],"author":{"name":"Antonis Theocharides"},"license":"BSD","gitHead":"8a3574d1d1792c533ae266dbf42d50070d449744","bugs":{"url":"https://github.com/atheohar/brauth/issues"},"_id":"brauth@0.0.4","dist":{"shasum":"fa8e096ea1fa04ac652fccce33cc29f2ec09c0a9","tarball":"https://registry.npmjs.org/brauth/-/brauth-0.0.4.tgz","integrity":"sha512-9DpwOi5yhrKKNwm3Ve2eXQif2q6ekV5Q7r5Fno/nVnsIYZANpwWOUgDKGHmF6FMZUhIp+eVw4cldEpOrth/eww==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICG+mirAb7jtGeGZO0F0mIyRDpXQoMZbD2AxgXvtAuPrAiBi7YQJic+Apjon+SrpUIGloYixKLzKz63NS1TwFTaQUQ=="}]},"_from":".","_npmVersion":"1.2.30","_npmUser":{"name":"atheohar","email":"atheohar@gmail.com"},"maintainers":[{"name":"atheohar","email":"atheohar@gmail.com"}]},"0.0.5":{"name":"brauth","version":"0.0.5","description":"Bold Rocket Authentication module","main":"index.js","scripts":{"test":"for f in tests/*; do echo \"$f\"; node \"$f\"; done; echo 'passed!'; exit 0"},"dependencies":{"bcrypt-nodejs":"~0.0.3","node-rest-client":"~0.8.0","form-data":"~0.1.2","request":"~2.34.0"},"repository":{"type":"git","url":"https://github.com/atheohar/brauth.git"},"keywords":["npm","module","brauth"],"author":{"name":"Antonis Theocharides"},"license":"BSD","gitHead":"8a3574d1d1792c533ae266dbf42d50070d449744","bugs":{"url":"https://github.com/atheohar/brauth/issues"},"_id":"brauth@0.0.5","dist":{"shasum":"8b585ac910a105181f3e2945d385f7577cde46fd","tarball":"https://registry.npmjs.org/brauth/-/brauth-0.0.5.tgz","integrity":"sha512-YaQh0imdgu6mvJ1GvUBtsDss4hNpLgymOsHAic4HpzI6CXJ4KxLKlBOGhCwyVS8wnxVEbzNRmuGKHzm5/yYUYA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFyfbhn5Kcn5GhYYTmpix7m6Sl/7en2TQpV67xFGdokOAiEApstWarykYZQ8UNjiiAZnlIHodMNGymrrsQtVjFOd9KU="}]},"_from":".","_npmVersion":"1.2.30","_npmUser":{"name":"atheohar","email":"atheohar@gmail.com"},"maintainers":[{"name":"atheohar","email":"atheohar@gmail.com"}]},"0.0.7":{"name":"brauth","version":"0.0.7","description":"Bold Rocket Authentication module","main":"index.js","scripts":{"test":"for f in tests/*; do echo \"$f\"; node \"$f\"; done; echo 'passed!'; exit 0"},"dependencies":{"bcrypt-nodejs":"~0.0.3","node-rest-client":"~0.8.0","form-data":"~0.1.2","request":"~2.34.0"},"repository":{"type":"git","url":"https://github.com/atheohar/brauth.git"},"keywords":["npm","module","brauth"],"author":{"name":"Antonis Theocharides"},"license":"BSD","gitHead":"8a3574d1d1792c533ae266dbf42d50070d449744","bugs":{"url":"https://github.com/atheohar/brauth/issues"},"_id":"brauth@0.0.7","dist":{"shasum":"235e48216f3f070e31639f6eba60917543405ea6","tarball":"https://registry.npmjs.org/brauth/-/brauth-0.0.7.tgz","integrity":"sha512-HjNehHOoi9l8N01FfFKiQWGfmBjckAb7QhtAb9U+N2JIsqEnAvvVGjAmdK72d0G1PZExz16to2VAw3l7mckNTw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG7/TsCUyYqwghxFSY9ruwAI9wFxtZ/+6VPwHCGDiCEYAiBe5doaG9Ys1TzsnAok+tabRqB1lWmyCop7Ya3IoMU+Ig=="}]},"_from":".","_npmVersion":"1.2.30","_npmUser":{"name":"atheohar","email":"atheohar@gmail.com"},"maintainers":[{"name":"atheohar","email":"atheohar@gmail.com"}]}},"readme":"# Brauth\n\nBrauth is a node js module that connects as a client to the Bold Rocket \ncentralised authentication system. The module provides an api to register\na user to the authentication system, authenticate a user and manage their\nprofile across differenet applications. \n\nBrauth provides around 15 api calls that are split based on their functionality\ninto [ApplicationAPI], [UserAPI] and [UserProfileAPI]. All these\nfunctions assume you follow the node.js convention of providing a single\ncallback as the last argument of your function with an error as the first\nargument and the data in the second.\n\n\n## Prerequisites\n\nIn order to use the brauth module you will need to pass in a mongodb object\nin order to store the sessions in the database, an application id and application\ncode that need to be requested beforehand so that the Bold Rocket authentication\nsystem recognises the application using its service and finally the Bold rocket \nauthentication system url. An example of initializing the module is shown below:\n\n__Arguments__\n\n* db (required) - mongodb instance\n* applicationId (required) - application unique identifier\n* applicationCode (required) - shared secret with authentication service\n* brAuthUrl (required) - authentication service url \n\n```javascript\n\nvar BrAuthAPI = require('brauth').BrAuthAPI;\n\n// function that utilises the module\nfunction client(){\n  // db is a mongodb instance\n  // appplicationId and applicationCode need to be requested\n  // brAuthUrl is the Bold Rocket authentication service url\n  var brAuthAPI = new BrAuthAPI(db, applicationId, applicationCode, brAuthUrl);\n}\n```\n\n## Download\n\nThe source is available for download from\n[GitHub](https://github.com/atheohar/brauth).\nAlternatively, you can install using Node Package Manager (npm):\n\n    npm install brauth\n\n## Documentation\n\n### User API\n\nThe user api is accessible by calling brAuthAPI.UserAPI\n\n* [Signup](#Signup)\n* [Login](#Login)\n* [Logout](#Logout)\n* [GetLoggedInUser](#GetLoggedInUser)\n* [PasswordUpdate](#PasswordUpdate)\n* [PasswordReset](#PasswordReset)\n* [PasswordChangeWithAuthenticationCode](#PasswordChangeWithAuthenticationCode)\n\n### User Profile API\n\nThe user profile api is accessible by calling brAuthAPI.UserProfileAPI\n\n* [GetUserProfile](#GetUserProfile)\n* [UserProfileUpdate](#UserProfileUpdate)\n* [GetUserProfileImage](#GetUserProfileImage)\n* [UserProfileImageUpdate](#UserProfileImageUpdate)\n\n### Application API\n\nThe application api is accessible by calling brAuthAPI.applicationAPI. You will\nneed to have administrator permission to be able to call these.\n\n* [GetApplications](#GetApplications)\n* [ApplicationCreate](#ApplicationCreate)\n* [ApplicationUpdate](#ApplicationUpdate)\n* [ApplicationDelete](#ApplicationDelete)\n\n## User API\n\n<a name=\"Signup\" />\n### UserAPI.Signup(email, username, password, firstName, lastName, callback)\n\nRegisters a user to the authentication service.\n\n__Arguments__\n\n* email (required) - The email address for user. The email needs to be unique in the system.\n* username (required) - The username for the user. The username needs to be unique in the system.\n* password (required) - The password for the user. Needs to contain an uppercase character, \na number, a special character and it needs to be between 6 and 20 characters.\n* firstName (required) - The first name for the user.\n* lastName (required) - The last name for the user.\n* callback(err, data) - A callback which is called after the user has been registered or an error \nhas occurred. The returned data contains the session identifier [sessionId] which is stored in the \ndatabase, the user role [userRole(ADMIN/USER)] and if the call was sucessful [success(true/false)] \n\n__Example__\n\n```js\n  brAuthAPI.UserAPI.Signup(email, username, password, firstName, lastName, function(err,data){\n    // handle error\n    if(err){\n      return next(err);\n    }\n\n    // store the session id as a cookie\n    res.cookie('session', data.sessionId);\n\n    // return data to the browser\n    return res.send({success:data.success, userRole:data.userRole});\n\n  });\n```\n\n---------------------------------------\n\n<a name=\"Login\" />\n### UserAPI.Login(username, password, callback)\n\nLog in user to the authentication service.\n\n__Arguments__\n\n* username (required) - The username for the user.\n* password (required) - The password for the user.\n* callback(err, data) - A callback which is called after the user has been logged in or an error \nhas occurred. The returned data contains the session identifier [sessionId] which is stored in the \ndatabase, the user role [userRole(ADMIN/USER)] and if the call was sucessful [success(true/false)] \n\n__Example__\n\n```js\n  brAuthAPI.UserAPI.Login(username, password, function(err,data){\n    // handle error\n    if(err){\n      return next(err);\n    }\n\n    // store the session id as a cookie\n    res.cookie('session', data.sessionId);\n\n    // return data to the browser\n    return res.send({success:data.success, userRole:data.userRole});\n  });\n```\n\n---------------------------------------\n\n<a name=\"Logout\" />\n### UserAPI.Logout(sessionId, callback)\n\nLog out user from authentication service.\n\n__Arguments__\n\n* sessionId (required) - The session id that login or register returns.\n* callback(err, data) - A callback which is called after the user has been logged out or an error \nhas occurred. The returned data contains a success field depending on if the call was sucessful \n[success(true/false)] \n\n__Example__\n\n```js\n  brAuthAPI.UserAPI.Logout(sessionId, function(err,data){\n    // handle error\n    if(err){\n      return next(err);\n    }\n\n    // return data to the browser\n    return res.send({success:data.success});\n  });\n```\n\n---------------------------------------\n\n<a name=\"GetLoggedInUser\" />\n### UserAPI.GetLoggedInUser(sessionId, callback)\n\nVerifies that the user is logged in and returns the user's username and role.\n\n__Arguments__\n\n* sessionId (required) - The session id that login or register returns.\n* callback(err, data) - A callback which is called after the user has been verified or an error \nhas occurred. The returned data contains the [username] and user role [userRole]. \n\n__Example__\n\n```js\n  brAuthAPI.UserAPI.GetLoggedInUser(sessionId, function(err,data){\n    // handle error\n    if(err){\n      return next(err);\n    }\n\n    var username = data.username;\n    var userRole = data.userRole;\n\n    // return data to the browser\n    return res.send({username:data.username, userRole:data.userRole});\n\n  });\n```\n\n---------------------------------------\n\n<a name=\"PasswordUpdate\" />\n### UserAPI.PasswordUpdate(sessionId, oldPassword, newPassword, callback)\n\nUpdated the password of a logged in user and updates the sesssion.\n\n__Arguments__\n\n* sessionId (required) - The session id that login or register returns.\n* oldPassword (required) - The old user password.\n* newPassword (required) - The new password. Needs to contain an uppercase character, \na number, a special character and it needs to be between 6 and 20 characters.\n* callback(err, data) - A callback which is called after the user password has been updated or an error \nhas occurred. The returned data contains the session identifier [sessionId] which is stored in the \ndatabase, the user role [userRole(ADMIN/USER)] and if the call was sucessful [success(true/false)] \n\n__Example__\n\n```js\n  brAuthAPI.UserAPI.PasswordUpdate(sessionId, oldPassword, newPassword, function(err,data){\n    // handle error\n    if(err){\n      return next(err);\n    }\n\n    // store the session id as a cookie\n    res.cookie('session', data.sessionId);\n\n    // return data to the browser\n    return res.send({success:data.success, userRole:data.userRole});\n\n  });\n```\n\n---------------------------------------\n\n<a name=\"PasswordReset\" />\n### UserAPI.PasswordReset(username, email, firstName, lastName, callback)\n\nRequest a password reset. This will send a mail to the user providing an authentication code.\n\n__Arguments__\n\n* email (required) - The email address for user.\n* username (required) - The username for the user.\n* firstName (required) - The first name for the user.\n* lastName (required) - The last name for the user.\n* callback(err, data) - A callback which is called after the password reset request was successfull \nor an error has occurred. The returned data contains a success field depending on if the call was \nsucessful [success(true/false)] \n\n__Example__\n\n```js\n  brAuthAPI.UserAPI.PasswordReset(username, email, firstName, lastName, function(err,data){\n    // handle error\n    if(err){\n      return next(err);\n    }\n\n    // return data to the browser\n    return res.send({success:data.success});\n\n  });\n```\n\n---------------------------------------\n\n<a name=\"PasswordChangeWithAuthenticationCode\" />\n### UserAPI.PasswordChangeWithAuthenticationCode(username, email, firstName, lastName, \nnewPassword, authenticationCode, callback)\n\nRequest a password reset. This will send a mail to the user providing an authentication code.\n\n__Arguments__\n\n* authenticationCode (required) - Authentication code produced and send to the user from the PasswordReset call\n* email (required) - The email address for user.\n* username (required) - The username for the user.\n* firstName (required) - The first name for the user.\n* lastName (required) - The last name for the user.\n* newPassword (required) - The new password. Needs to contain an uppercase character, \na number, a special character and it needs to be between 6 and 20 characters.\n* callback(err, data) - A callback which is called after the user password has been updated or an error \nhas occurred. The returned data contains the session identifier [sessionId] which is stored in the \ndatabase, the user role [userRole(ADMIN/USER)] and if the call was sucessful [success(true/false)] \n\n__Example__\n\n```js\n  brAuthAPI.UserAPI.PasswordChangeWithAuthenticationCode(username, email, firstName, lastName,\n            newPassword, authenticationCode,function(err,data){\n    // handle error\n    if(err){\n      return next(err);\n    }\n\n    // store the session id as a cookie\n    res.cookie('session', data.sessionId);\n\n    // return data to the browser\n    return res.send({success:data.success, userRole:data.userRole});\n\n  });\n```\n\n---------------------------------------\n\n## User Profile API\n\n<a name=\"GetUserProfile\" />\n### UserProfileAPI.GetUserProfile(sessionId, callback)\n\nGet the use profile.\n\n__Arguments__\n\n* sessionId (required) - The session id that login or register returns.\n* callback(err, data) - A callback which is called after the user profile is retrieved or an error \nhas occurred. The returned data contains the user profile.\nAn example of all the fields:\n\n{\n  \"firstName\":\"Antonis\",\n  \"lastName\":\"Theocharides\",\n  \"phoneNumber\":\"123456789\",\n  \"dateOfBirth\":\"1983-01-01\",\n  \"placeOfBirth\":\"Cyprus\",\n  \"maritalStatus\":\"SINGLE\",\n  \"gender\":\"MALE\",\n  \"address\":{\n    \"addressLine1\":\"103 some road\",\n    \"addressLine2\":\"\",\n    \"county\":\"London\",\n    \"town\":\"London\",\n    \"postCode\":\"abc 123\"\n  }\n}\n\n__Example__\n\n```js\n  brAuthAPI.UserProfileAPI.GetUserProfile(sessionId, function(err,data){\n    // handle error\n    if(err){\n      return next(err);\n    }\n\n    // return data to the browser\n    var firstName = data.firstName;\n    var lastName = data.lastName;\n    return res.send({firstName:firstName, lastName:lastName});\n\n  });\n```\n\n---------------------------------------\n\n<a name=\"UserProfileUpdate\" />\n### UserProfileAPI.UserProfileUpdate(sessionId, firstName, lastName, phoneNumber, dateOfBirth, placeOfBirth, maritalStatus, gender, addressLine1, addressLine2, county, town, postCode, callback)\n\nUpdate the use profile. All empty fields are ignored.\n\n__Arguments__\n\n* sessionId (required) - The session id that login or register returns.\n* firstName (required) - The first name for the user. Empty if it will not be updated.\n* lastName (required) - The last name for the user.Empty if it will not be updated.\n* phoneNumber (required) - The phone number of the user. Empty if it will not be updated.\n* dateOfBirth (required) - The date of birth of the user. Accepted format is yyyy-mm-dd. Empty if it will not be updated.\n* placeOfBirth (required) - The place of birth of the user. Empty if it will not be updated.\n* maritalStatus (required) - The marital status of the user. Empty if it will not be updated.\n* gender (required) - The gender of the user (MALE/FEMAIL). Empty if it will not be updated.\n* addressLine1 (required) - The first address line of the user address. Empty if it will not be updated.\n* addressLine2 (required) - The second address line of the user address. Empty if it will not be updated.\n* county (required) - The county of the user address. Empty if it will not be updated.\n* town (required) - The town of the user address. Empty if it will not be updated.\n* postCode (required) - The post code of the user address. Empty if it will not be updated.\n* callback(err, data) - A callback which is called after the user profile is retrieved or an error \nhas occurred. The returned data contains the user profile.\nAn example of all the fields:\n\n{\n  \"firstName\":\"Antonis\",\n  \"lastName\":\"Theocharides\",\n  \"phoneNumber\":\"123456789\",\n  \"dateOfBirth\":\"1983-01-01\",\n  \"placeOfBirth\":\"Cyprus\",\n  \"maritalStatus\":\"SINGLE\",\n  \"gender\":\"MALE\",\n  \"address\":{\n    \"addressLine1\":\"103 some road\",\n    \"addressLine2\":\"\",\n    \"county\":\"London\",\n    \"town\":\"London\",\n    \"postCode\":\"abc 123\"\n  }\n}\n\n__Example__\n\n```js\n  brAuthAPI.UserProfileAPI.UserProfileUpdate(sessionId, firstName, lastName, phoneNumber, dateOfBirth,\n            placeOfBirth, maritalStatus, gender, addressLine1, addressLine2,\n            county, town, postCode, function(err,data){\n    // handle error\n    if(err){\n      return next(err);\n    }\n\n    // return data to the browser\n    var firstName = data.firstName;\n    var lastName = data.lastName;\n    return res.send({firstName:firstName, lastName:lastName});\n\n  });\n```\n\n---------------------------------------\n\n<a name=\"GetUserProfileImage\" />\n### UserProfileAPI.GetUserProfileImage(sessionId, callback)\n\nGet the user profile image url.\n\n__Arguments__\n\n* sessionId (required) - The session id that login or register returns.\n* callback(err, data) - A callback which is called after the user profile image url is retrieved or an error \nhas occurred. The returned data contains the user profile image url.\n\n__Example__\n\n```js\n  brAuthAPI.UserProfileAPI.GetUserProfileImage(sessionId, function(err,data){\n    // handle error\n    if(err){\n      return next(err);\n    }\n\n    // return data to the browser\n    var imageUrl = data.url;\n    return res.send({imageUrl:imageUrl});\n\n  });\n```\n\n---------------------------------------\n\n<a name=\"GetUserProfileImage\" />\n### UserProfileAPI.UserProfileImageUpdate(sessionId, filePath, callback)\n\nGet the user profile image url.\n\n__Arguments__\n\n* sessionId (required) - The session id that login or register returns.\n* filePath (required) - The local file path of the image to be uploaded\n* callback(err, data) - A callback which is called after the user profile image url is retrieved or an error \nhas occurred. The returned data contains the user profile image url.\n\n__Example__\n\n```js\n  brAuthAPI.UserProfileAPI.UserProfileImageUpdate(sessionId, req.files.myFile.path, function(err,data){\n    // handle error\n    if(err){\n      return next(err);\n    }\n\n    // return data to the browser\n    var imageUrl = data.url;\n    return res.send({imageUrl:imageUrl});\n\n  });\n```\n\n---------------------------------------\n\n## Application API\n\nThe application api calls need administrator permissions to work\n\n<a name=\"GetApplications\" />\n### ApplicationAPI.GetApplications(sessionId, callback)\n\nGet a list of the applications registered in the authentication service.\n\n__Arguments__\n\n* sessionId (required) - The session id that login or register returns.\n* callback(err, data) - A callback which is called after the list of applications is retrieved or an error \nhas occurred. The returned data contains a list of applicationId and applicationCode tuples.\ne.g\n[\n  { \n    \"applicationId\":\"applicationName\",\n    \"applicationCode\":\"12345667\"\n  }\n]\n\n__Example__\n\n```js\n  brAuthAPI.ApplicationAPI.GetApplications(sessionId, function(err,data){\n    // handle error\n    if(err){\n      return next(err);\n    }\n\n    // return first application data to the browser\n    var applicationId = data[0].applicationId;\n    var applicationCode = data[0].applicationCode;\n    return res.send({applicationId:applicationId, applicationCode:applicationCode});\n\n  });\n```\n\n---------------------------------------\n\n<a name=\"ApplicationCreate\" />\n### ApplicationAPI.ApplicationCreate(sessionId, applicationId, callback)\n\nRegistered a new application in the authentication service.\n\n__Arguments__\n\n* sessionId (required) - The session id that login or register returns.\n* applicationId (required) - The application name. Must be unique in the authentication service.\n* callback(err, data) - A callback which is called after the applications is created or an error \nhas occurred. The returned data contains applicationId and applicationCode.\n\n__Example__\n\n```js\n  brAuthAPI.ApplicationAPI.ApplicationCreate(sessionId, applicationId, function(err,data){\n    // handle error\n    if(err){\n      return next(err);\n    }\n\n    // return first application data to the browser\n    var applicationId = data.applicationId;\n    var applicationCode = data.applicationCode;\n    return res.send({applicationId:applicationId, applicationCode:applicationCode});\n\n  });\n```\n\n---------------------------------------\n\n<a name=\"ApplicationUpdate\" />\n### ApplicationAPI.ApplicationUpdate(sessionId, applicationId, applicationCode, callback)\n\nUpdate the application code of a specific application.\n\n__Arguments__\n\n* sessionId (required) - The session id that login or register returns.\n* applicationId (required) - The application name.\n* applicationCode (required) - The new application code that the application will use.\n* callback(err, data) - A callback which is called after the applications is updated or an error \nhas occurred. The returned data contains applicationId and applicationCode.\n\n__Example__\n\n```js\n  brAuthAPI.ApplicationAPI.ApplicationUpdate(sessionId, applicationId, applicationCode, function(err,data){\n    // handle error\n    if(err){\n      return next(err);\n    }\n\n    // return first application data to the browser\n    var applicationId = data.applicationId;\n    var applicationCode = data.applicationCode;\n    return res.send({applicationId:applicationId, applicationCode:applicationCode});\n\n  });\n```\n\n---------------------------------------\n\n<a name=\"ApplicationDelete\" />\n### ApplicationAPI.ApplicationDelete(sessionId, applicationId, callback)\n\nDelete an application in the authentication service.\n\n__Arguments__\n\n* sessionId (required) - The session id that login or register returns.\n* applicationId (required) - The application name.\n* callback(err, data) - A callback which is called after the applications is deleted or an error \nhas occurred. The returned data contains a success field depending on if the call was sucessful \n[success(true/false)] \n\n__Example__\n\n```js\n  brAuthAPI.ApplicationAPI.ApplicationDelete(sessionId, applicationId, function(err,data){\n    // handle error\n    if(err){\n      return next(err);\n    }\n\n    // return first application data to the browser\n    return res.send({success:data.success});\n\n  });\n```\n\n---------------------------------------\n\n\n","maintainers":[{"name":"atheohar","email":"atheohar@gmail.com"}],"time":{"modified":"2022-06-13T05:05:01.523Z","created":"2014-03-27T16:14:46.374Z","0.0.0":"2014-03-27T16:14:48.310Z","0.0.1":"2014-03-27T16:16:46.876Z","0.0.2":"2014-03-27T16:23:05.783Z","0.0.3":"2014-03-27T16:44:42.883Z","0.0.4":"2014-03-28T14:19:57.234Z","0.0.5":"2014-03-28T14:28:40.235Z","0.0.7":"2014-03-28T14:31:47.841Z"},"readmeFilename":"README.md","keywords":["npm","module","brauth"],"repository":{"type":"git","url":"https://github.com/atheohar/brauth.git"},"author":{"name":"Antonis Theocharides"},"bugs":{"url":"https://github.com/atheohar/brauth/issues"},"license":"BSD"}