UNPKG

fluro

Version:

Promise based HTTP Fluro client for the browser and node.js

3,056 lines (845 loc) 46.4 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>auth - Documentation</title> <script src="scripts/prettify/prettify.js"></script> <script src="scripts/prettify/lang-css.js"></script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> <script src="scripts/nav.js" defer></script> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <input type="checkbox" id="nav-trigger" class="nav-trigger" /> <label for="nav-trigger" class="navicon-button x"> <div class="navicon"></div> </label> <label for="nav-trigger" class="overlay"></label> <nav > <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="access.html">access</a><ul class='methods'><li data-type='method'><a href="access.html#.addEventListener">addEventListener</a></li><li data-type='method'><a href="access.html#.can">can</a></li><li data-type='method'><a href="access.html#.canDeleteItem">canDeleteItem</a></li><li data-type='method'><a href="access.html#.canEditItem">canEditItem</a></li><li data-type='method'><a href="access.html#.canKnowOf">canKnowOf</a></li><li data-type='method'><a href="access.html#.canViewItem">canViewItem</a></li><li data-type='method'><a href="access.html#.has">has</a></li><li data-type='method'><a href="access.html#.isAuthor">isAuthor</a></li><li data-type='method'><a href="access.html#.removeAllListeners">removeAllListeners</a></li><li data-type='method'><a href="access.html#.removeEventListener">removeEventListener</a></li><li data-type='method'><a href="access.html#.retrieveActionableRealms">retrieveActionableRealms</a></li><li data-type='method'><a href="access.html#.retrieveCurrentSession">retrieveCurrentSession</a></li><li data-type='method'><a href="access.html#.setDefaultApplication">setDefaultApplication</a></li></ul></li><li><a href="api.html">api</a><ul class='methods'><li data-type='method'><a href="api.html#.delete">delete</a></li><li data-type='method'><a href="api.html#.generateEndpointURL">generateEndpointURL</a></li><li data-type='method'><a href="api.html#.get">get</a></li><li data-type='method'><a href="api.html#.post">post</a></li><li data-type='method'><a href="api.html#.put">put</a></li></ul></li><li><a href="app.device.html">device</a></li><li><a href="asset.html">asset</a><ul class='methods'><li data-type='method'><a href="asset.html#.avatarUrl">avatarUrl</a></li><li data-type='method'><a href="asset.html#.downloadUrl">downloadUrl</a></li><li data-type='method'><a href="asset.html#.filesize">filesize</a></li><li data-type='method'><a href="asset.html#.getUrl">getUrl</a></li><li data-type='method'><a href="asset.html#.imageUrl">imageUrl</a></li><li data-type='method'><a href="asset.html#.playerUrl">playerUrl</a></li><li data-type='method'><a href="asset.html#.posterUrl">posterUrl</a></li><li data-type='method'><a href="asset.html#.typeFromMime">typeFromMime</a></li></ul></li><li><a href="auth.html">auth</a><ul class='methods'><li data-type='method'><a href="auth.html#.addEventListener">addEventListener</a></li><li data-type='method'><a href="auth.html#.changeAccount">changeAccount</a></li><li data-type='method'><a href="auth.html#.getCurrentToken">getCurrentToken</a></li><li data-type='method'><a href="auth.html#.getCurrentUser">getCurrentUser</a></li><li data-type='method'><a href="auth.html#.impersonate">impersonate</a></li><li data-type='method'><a href="auth.html#.login">login</a></li><li data-type='method'><a href="auth.html#.logout">logout</a></li><li data-type='method'><a href="auth.html#.refreshAccessToken">refreshAccessToken</a></li><li data-type='method'><a href="auth.html#.removeAllListeners">removeAllListeners</a></li><li data-type='method'><a href="auth.html#.removeEventListener">removeEventListener</a></li><li data-type='method'><a href="auth.html#.retrieveUserFromResetToken">retrieveUserFromResetToken</a></li><li data-type='method'><a href="auth.html#.sendResetPasswordRequest">sendResetPasswordRequest</a></li><li data-type='method'><a href="auth.html#.set">set</a></li><li data-type='method'><a href="auth.html#.signup">signup</a></li><li data-type='method'><a href="auth.html#.updateUserWithToken">updateUserWithToken</a></li></ul></li><li><a href="cache.html">cache</a><ul class='methods'><li data-type='method'><a href="cache.html#.get">get</a></li><li data-type='method'><a href="cache.html#.reset">reset</a></li></ul></li><li><a href="components.html">components</a><ul class='methods'><li data-type='method'><a href="components.html#.hydrateModel">hydrateModel</a></li></ul></li><li><a href="content.html">content</a><ul class='methods'><li data-type='method'><a href="content.html#.duplicate">duplicate</a></li><li data-type='method'><a href="content.html#.external">external</a></li><li data-type='method'><a href="content.html#.filter">filter</a></li><li data-type='method'><a href="content.html#.form">form</a></li><li data-type='method'><a href="content.html#.get">get</a></li><li data-type='method'><a href="content.html#.getMultiple">getMultiple</a></li><li data-type='method'><a href="content.html#.keys">keys</a></li><li data-type='method'><a href="content.html#.list">list</a></li><li data-type='method'><a href="content.html#.query">query</a></li><li data-type='method'><a href="content.html#.related">related</a></li><li data-type='method'><a href="content.html#.retrieve">retrieve</a></li><li data-type='method'><a href="content.html#.slug">slug</a></li><li data-type='method'><a href="content.html#.submitInteraction">submitInteraction</a></li><li data-type='method'><a href="content.html#.submitPost">submitPost</a></li><li data-type='method'><a href="content.html#.thread">thread</a></li><li data-type='method'><a href="content.html#.values">values</a></li></ul></li><li><a href="date.html">date</a><ul class='methods'><li data-type='method'><a href="date.html#.countdown">countdown</a></li><li data-type='method'><a href="date.html#.dateFromID">dateFromID</a></li><li data-type='method'><a href="date.html#.formatDate">formatDate</a></li><li data-type='method'><a href="date.html#.getAge">getAge</a></li><li data-type='method'><a href="date.html#.groupEventByDate">groupEventByDate</a></li><li data-type='method'><a href="date.html#.isDifferentTimezoneThanUser">isDifferentTimezoneThanUser</a></li><li data-type='method'><a href="date.html#.isMultiDayEvent">isMultiDayEvent</a></li><li data-type='method'><a href="date.html#.localDate">localDate</a></li><li data-type='method'><a href="date.html#.militaryTimestamp">militaryTimestamp</a></li><li data-type='method'><a href="date.html#.readableEventDate">readableEventDate</a></li><li data-type='method'><a href="date.html#.readableEventTime">readableEventTime</a></li><li data-type='method'><a href="date.html#.timeago">timeago</a></li><li data-type='method'><a href="date.html#.timeline">timeline</a></li><li data-type='method'><a href="date.html#.timestampToAmPm">timestampToAmPm</a></li><li data-type='method'><a href="date.html#.timezones">timezones</a></li></ul></li><li><a href="fluro.html">fluro</a></li><li><a href="types.html">types</a><ul class='methods'><li data-type='method'><a href="types.html#.all">all</a></li><li data-type='method'><a href="types.html#.basicTypes">basicTypes</a></li><li data-type='method'><a href="types.html#.get">get</a></li><li data-type='method'><a href="types.html#.mapDefinitionItems">mapDefinitionItems</a></li><li data-type='method'><a href="types.html#.parentType">parentType</a></li><li data-type='method'><a href="types.html#.postableTypes">postableTypes</a></li><li data-type='method'><a href="types.html#.readable">readable</a></li><li data-type='method'><a href="types.html#.reloadTerminology">reloadTerminology</a></li><li data-type='method'><a href="types.html#.retrieve">retrieve</a></li><li data-type='method'><a href="types.html#.subTypes">subTypes</a></li><li data-type='method'><a href="types.html#.term">term</a></li></ul></li><li><a href="utils.html">utils</a><ul class='methods'><li data-type='method'><a href="utils.html#.arrayIDs">arrayIDs</a></li><li data-type='method'><a href="utils.html#.comma">comma</a></li><li data-type='method'><a href="utils.html#.currencySymbol">currencySymbol</a></li><li data-type='method'><a href="utils.html#.errorMessage">errorMessage</a></li><li data-type='method'><a href="utils.html#.extractFromArray">extractFromArray</a></li><li data-type='method'><a href="utils.html#.formatCurrency">formatCurrency</a></li><li data-type='method'><a href="utils.html#.getDefaultValueForField">getDefaultValueForField</a></li><li data-type='method'><a href="utils.html#.getFlattenedFields">getFlattenedFields</a></li><li data-type='method'><a href="utils.html#.getStringID">getStringID</a></li><li data-type='method'><a href="utils.html#.guid">guid</a></li><li data-type='method'><a href="utils.html#.hash">hash</a></li><li data-type='method'><a href="utils.html#.injectScript">injectScript</a></li><li data-type='method'><a href="utils.html#.machineName">machineName</a></li><li data-type='method'><a href="utils.html#.mapParameters">mapParameters</a></li><li data-type='method'><a href="utils.html#.matchInArray">matchInArray</a></li><li data-type='method'><a href="utils.html#.processCardPrioritySort">processCardPrioritySort</a></li></ul></li><li><a href="video.html">video</a><ul class='methods'><li data-type='method'><a href="video.html#.hhmmss">hhmmss</a></li><li data-type='method'><a href="video.html#.readableMilliseconds">readableMilliseconds</a></li><li data-type='method'><a href="video.html#.readableSeconds">readableSeconds</a></li></ul></li></ul> </nav> <div id="main"> <h1 class="page-title">auth</h1> <section> <header> <h2> auth </h2> </header> <article> <h3 class="subsection-title">Members</h3> <h4 class="name" id=".sync"><span class="type-signature">(static) </span>sync<span class="type-signature"></span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.auth.js.html">fluro.auth.js</a>, <a href="fluro.auth.js.html#line837">line 837</a> </li></ul></dd> </dl> <div class="description"> Helper function to resync the user's session from the server. This is often used when first loading a webpage or app just to see if the user's permissions have changed since the user first logged in from the FluroAuth service itself </div> <h3 class="subsection-title">Methods</h3> <h4 class="name" id=".addEventListener"><span class="type-signature">(static) </span>addEventListener<span class="signature">(event, callback)</span><span class="type-signature"></span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.auth.js.html">fluro.auth.js</a>, <a href="fluro.auth.js.html#line1134">line 1134</a> </li></ul></dd> </dl> <div class="description"> Adds a callback that will be triggered whenever the specified event occurs </div> <h5>Example</h5> <pre class="prettyprint"><code>//Listen for when the user session changes fluro.auth.addEventListener('change', function(userSession) {})</code></pre> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>event</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The event to listen for</td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last">The function to fire when this event is triggered</td> </tr> </tbody> </table> <h4 class="name" id=".changeAccount"><span class="type-signature">(static) </span>changeAccount<span class="signature">(accountID, options)</span><span class="type-signature"> &rarr; {Promise}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.auth.js.html">fluro.auth.js</a>, <a href="fluro.auth.js.html#line167">line 167</a> </li></ul></dd> </dl> <div class="description"> Retrieves a new session object for a Fluro global user for a specified account This will only work if the user has a persona in that account </div> <h5>Example</h5> <pre class="prettyprint"><code>fluro.auth.changeAccount('5be504eabf33991239599d63').then(function(userSession) { //New user session will be set automatically var newUserSession = fluro.auth.getCurrentUser(); }) fluro.auth.changeAccount('5be504eabf33991239599d63', {disableAutoAuthenticate:true}).then(function(userSession) { //Set the session manually fluro.auth.set(userSession) })</code></pre> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>accountID</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The _id of the account you wish to log in to</td> </tr> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>disableAutoAuthenticate</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">By default this function will set the current user session to account you are changing in to. If you want to generate the session without affecting your current session you can set disableAutoAuthenticate to true</td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> Resolves to the user session object, or rejects with the responding error </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> <h4 class="name" id=".getCurrentToken"><span class="type-signature">(static) </span>getCurrentToken<span class="signature">()</span><span class="type-signature"> &rarr; {String}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.auth.js.html">fluro.auth.js</a>, <a href="fluro.auth.js.html#line910">line 910</a> </li></ul></dd> </dl> <div class="description"> Returns the current user's access token </div> <h5>Returns:</h5> <div class="param-desc"> The Fluro access token for the current user session </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">String</span> </dd> </dl> <h4 class="name" id=".getCurrentUser"><span class="type-signature">(static) </span>getCurrentUser<span class="signature">()</span><span class="type-signature"> &rarr; {Object}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.auth.js.html">fluro.auth.js</a>, <a href="fluro.auth.js.html#line922">line 922</a> </li></ul></dd> </dl> <div class="description"> Returns the current user's session data </div> <h5>Returns:</h5> <div class="param-desc"> The current user session </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> <h4 class="name" id=".impersonate"><span class="type-signature">(static) </span>impersonate<span class="signature">(personaID, options)</span><span class="type-signature"> &rarr; {Promise}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.auth.js.html">fluro.auth.js</a>, <a href="fluro.auth.js.html#line223">line 223</a> </li></ul></dd> </dl> <div class="description"> Impersonates a persona and sets the current session to match the specified persona's context </div> <h5>Example</h5> <pre class="prettyprint"><code>fluro.auth.impersonate('5be504eabf33991239599d63') .then(function(userSession) { //New user session will be set automatically var newUserSession = fluro.auth.getCurrentUser(); })</code></pre> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>personaID</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The _id of the persona you wish to impersonate</td> </tr> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> Resolves to the user session object, or rejects with the responding error </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> <h4 class="name" id=".login"><span class="type-signature">(static) </span>login<span class="signature">(credentials, options)</span><span class="type-signature"> &rarr; {Promise}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.auth.js.html">fluro.auth.js</a>, <a href="fluro.auth.js.html#line272">line 272</a> </li></ul></dd> </dl> <div class="description"> Logs the user in to Fluro and returns a new user session </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>credentials</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>username</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The email address of the user to login as</td> </tr> <tr> <td class="name"><code>password</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The password for the user</td> </tr> </tbody> </table> </td> </tr> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">Extra options and configuration for the request <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>disableAutoAuthenticate</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">Disable automatic authentication, if true, will not set the current user session</td> </tr> <tr> <td class="name"><code>application</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">Whether to attempt to login to the current application as a managed user persona, if not set will login as a global Fluro user</td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> Returns a promise that either resolves with the logged in user session, or rejects with the responding error from the server </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> <h4 class="name" id=".logout"><span class="type-signature">(static) </span>logout<span class="signature">()</span><span class="type-signature"></span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.auth.js.html">fluro.auth.js</a>, <a href="fluro.auth.js.html#line112">line 112</a> </li></ul></dd> </dl> <div class="description"> Deletes the user session object, clears all Fluro caches and tokens from memory </div> <h5>Example</h5> <pre class="prettyprint"><code>fluro.auth.logout()</code></pre> <h4 class="name" id=".refreshAccessToken"><span class="type-signature">(static) </span>refreshAccessToken<span class="signature">(refreshToken, isManagedSession)</span><span class="type-signature"> &rarr; {Promise}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.auth.js.html">fluro.auth.js</a>, <a href="fluro.auth.js.html#line716">line 716</a> </li></ul></dd> </dl> <div class="description"> Helper function to refresh an access token for an authenticated user session. This is usually handled automatically from the FluroAuth service itself </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>refreshToken</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The refresh token to reactivate</td> </tr> <tr> <td class="name"><code>isManagedSession</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="description last">Whether or not the refresh token is for a managed persona session or a global Fluro user session</td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> A promise that either resolves with the refreshed token details or rejects with the responding error from the server </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> <h4 class="name" id=".removeAllListeners"><span class="type-signature">(static) </span>removeAllListeners<span class="signature">()</span><span class="type-signature"></span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.auth.js.html">fluro.auth.js</a>, <a href="fluro.auth.js.html#line1156">line 1156</a> </li></ul></dd> </dl> <div class="description"> Removes all listening callbacks for all events </div> <h5>Example</h5> <pre class="prettyprint"><code>fluro.auth.removeAllListeners()</code></pre> <h4 class="name" id=".removeEventListener"><span class="type-signature">(static) </span>removeEventListener<span class="signature">(event, callback)</span><span class="type-signature"></span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.auth.js.html">fluro.auth.js</a>, <a href="fluro.auth.js.html#line1145">line 1145</a> </li></ul></dd> </dl> <div class="description"> Removes all a callback from the listener list </div> <h5>Example</h5> <pre class="prettyprint"><code>//Stop listening for the change event fluro.auth.removeEventListener('change', myFunction)</code></pre> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>event</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The event to stop listening for</td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last">The function to remove from the listener list</td> </tr> </tbody> </table> <h4 class="name" id=".retrieveUserFromResetToken"><span class="type-signature">(static) </span>retrieveUserFromResetToken<span class="signature">(token, options)</span><span class="type-signature"> &rarr; {Promise}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.auth.js.html">fluro.auth.js</a>, <a href="fluro.auth.js.html#line505">line 505</a> </li></ul></dd> </dl> <div class="description"> Retrieves a user's details by providing a password reset token </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>token</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The password reset token that was sent to the user's email address</td> </tr> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">other options for the request <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>application</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="description last">If true will retrieve in the context of a managed persona in the same account as the current application. If not specified or false, will assume it's a Fluro global user that is resetting their password.</td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> Returns a promise that resolves with the reset session details </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> <h4 class="name" id=".sendResetPasswordRequest"><span class="type-signature">(static) </span>sendResetPasswordRequest<span class="signature">(body, options)</span><span class="type-signature"> &rarr; {Promise}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.auth.js.html">fluro.auth.js</a>, <a href="fluro.auth.js.html#line637">line 637</a> </li></ul></dd> </dl> <div class="description"> Triggers a new Reset Password email request to the specified user. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>body</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>username</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The email address of the user to reset the password for</td> </tr> <tr> <td class="name"><code>redirect</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">If the request is in the context of a managed user persona authenticated with an application, then you need to provide the url to direct the user to when they click the reset password link This is usually something like '/reset' for the current application, when the user clicks the link the reset token will be appended with ?token=RESET_TOKEN and your application should be ready on that url to handle the token and allow the user to use the token to reset their password</td> </tr> </tbody> </table> </td> </tr> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">Extra options and configuration for the request <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>application</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="description last">If true will send a reset email from the context of a managed persona in the same account as the current application. If not specified or false, will send a password reset request for a global Fluro user account.</td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> Returns a promise that either resolves if the password request was sent, or rejects if an error occurred </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> <h4 class="name" id=".set"><span class="type-signature">(static) </span>set<span class="signature">(user)</span><span class="type-signature"></span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.auth.js.html">fluro.auth.js</a>, <a href="fluro.auth.js.html#line91">line 91</a> </li></ul></dd> </dl> <div class="description"> Sets the current user data, often from localStorage or after new session data has been generated from the server after signing in </div> <h5>Example</h5> <pre class="prettyprint"><code>FluroAsset.set({firstName:'Jeff', lastName:'Andrews', ...})</code></pre> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>user</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">The user session object</td> </tr> </tbody> </table> <h4 class="name" id=".signup"><span class="type-signature">(static) </span>signup<span class="signature">(credentials, options)</span><span class="type-signature"> &rarr; {Promise}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.auth.js.html">fluro.auth.js</a>, <a href="fluro.auth.js.html#line385">line 385</a> </li></ul></dd> </dl> <div class="description"> Signs up a new user to the current application, this will create a new managed user persona and automatically log in as that persona in the current application context. This function will only work when called in context of an application with the 'Application Token' authentication style. It will create a new user persona in the account of the application and return a session with all of the application's permissions and application's logged in user permissions </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>credentials</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"> <h6>Properties</h6> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>firstName</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The first name for the new user persona</td> </tr> <tr> <td class="name"><code>lastName</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The last name for the new user persona</td> </tr> <tr> <td class="name"><code>username</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The email address for the new persona</td> </tr> <tr> <td class="name"><code>password</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The password to set for the new persona</td> </tr> <tr> <td class="name"><code>confirmPassword</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">A double check to confirm the new password for the persona</td> </tr> </tbody> </table> </td> </tr> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">Extra options and configuration for the request</td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> Returns a promise that either resolves to the new authenticated session, or rejects with the responding error from the server </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> <h4 class="name" id=".updateUserWithToken"><span class="type-signature">(static) </span>updateUserWithToken<span class="signature">(token, body, options)</span><span class="type-signature"> &rarr; {Promise}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.auth.js.html">fluro.auth.js</a>, <a href="fluro.auth.js.html#line558">line 558</a> </li></ul></dd> </dl> <div class="description"> Updates a user's details including password by providing a password reset token </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>token</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The password reset token that was sent to the user's email address</td> </tr> <tr> <td class="name"><code>body</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">The details to change for the user</td> </tr> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">other options for the request</td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> Returns a promise that resolves with the reset session details </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Promise</span> </dd> </dl> </article> </section> </div> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Tue Jun 29 2021 08:38:17 GMT+1000 (Australian Eastern Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. </footer> <script>prettyPrint();</script> <script src="scripts/polyfill.js"></script> <script src="scripts/linenumber.js"></script> </body> </html>