UNPKG

@qikdev/sdk

Version:

Promise based Javascript SDK

2,180 lines (578 loc) 36.7 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#.actionableScopes">actionableScopes</a></li><li data-type='method'><a href="access.html#.allPermissions">allPermissions</a></li><li data-type='method'><a href="access.html#.allPermissionTypes">allPermissionTypes</a></li><li data-type='method'><a href="access.html#.allUserScopes">allUserScopes</a></li><li data-type='method'><a href="access.html#.canCreate">canCreate</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#.canEraseItem">canEraseItem</a></li><li data-type='method'><a href="access.html#.canKnowOf">canKnowOf</a></li><li data-type='method'><a href="access.html#.canListItem">canListItem</a></li><li data-type='method'><a href="access.html#.canRestoreItem">canRestoreItem</a></li><li data-type='method'><a href="access.html#.canViewItem">canViewItem</a></li><li data-type='method'><a href="access.html#.checkActionAccess">checkActionAccess</a></li><li data-type='method'><a href="access.html#.getAllDescendants">getAllDescendants</a></li><li data-type='method'><a href="access.html#.has">has</a></li><li data-type='method'><a href="access.html#.hasFeature">hasFeature</a></li><li data-type='method'><a href="access.html#.hashPermissions">hashPermissions</a></li><li data-type='method'><a href="access.html#.isAdministrator">isAdministrator</a></li><li data-type='method'><a href="access.html#.isAssignee">isAssignee</a></li><li data-type='method'><a href="access.html#.isOwner">isOwner</a></li></ul></li><li><a href="api.html">api</a><ul class='methods'><li data-type='method'><a href="api.html#.generateEndpointURL">generateEndpointURL</a></li></ul></li><li><a href="auth.html">auth</a><ul class='methods'><li data-type='method'><a href="auth.html#.changeOrganisation">changeOrganisation</a></li><li data-type='method'><a href="auth.html#.ensureValidToken">ensureValidToken</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#.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#.sync">sync</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="content.html">content</a><ul class='methods'><li data-type='method'><a href="content.html#.create">create</a></li><li data-type='method'><a href="content.html#.delete">delete</a></li><li data-type='method'><a href="content.html#.get">get</a></li><li data-type='method'><a href="content.html#.getFromSlug">getFromSlug</a></li><li data-type='method'><a href="content.html#.glossary">glossary</a></li><li data-type='method'><a href="content.html#.list">list</a></li><li data-type='method'><a href="content.html#.patch">patch</a></li><li data-type='method'><a href="content.html#.restore">restore</a></li><li data-type='method'><a href="content.html#.scopeGlossary">scopeGlossary</a></li><li data-type='method'><a href="content.html#.update">update</a></li><li data-type='method'><a href="content.html#.validateField">validateField</a></li><li data-type='method'><a href="content.html#.variables">variables</a></li></ul></li><li><a href="files.html">files</a><ul class='methods'><li data-type='method'><a href="files.html#.downloadUrl">downloadUrl</a></li><li data-type='method'><a href="files.html#.duration">duration</a></li><li data-type='method'><a href="files.html#.filesize">filesize</a></li><li data-type='method'><a href="files.html#.getBinaryTypeFromMime">getBinaryTypeFromMime</a></li><li data-type='method'><a href="files.html#.mediaUrl">mediaUrl</a></li></ul></li><li><a href="filter.html">filter</a><ul class='methods'><li data-type='method'><a href="filter.html#.activeFilterComparators">activeFilterComparators</a></li><li data-type='method'><a href="filter.html#.activeFilterKeys">activeFilterKeys</a></li><li data-type='method'><a href="filter.html#.activeFilterOperators">activeFilterOperators</a></li><li data-type='method'><a href="filter.html#.activeFilters">activeFilters</a></li><li data-type='method'><a href="filter.html#.activeFilterValues">activeFilterValues</a></li><li data-type='method'><a href="filter.html#.filterChangeString">filterChangeString</a></li><li data-type='method'><a href="filter.html#.isValidFilter">isValidFilter</a></li></ul></li><li><a href="geo.html">geo</a><ul class='methods'><li data-type='method'><a href="geo.html#.distance">distance</a></li><li data-type='method'><a href="geo.html#.getDefaultCountry">getDefaultCountry</a></li><li data-type='method'><a href="geo.html#.getDefaultTimezone">getDefaultTimezone</a></li><li data-type='method'><a href="geo.html#.getPosition">getPosition</a></li><li data-type='method'><a href="geo.html#.stopWatchPosition">stopWatchPosition</a></li><li data-type='method'><a href="geo.html#.watchPosition">watchPosition</a></li></ul></li><li><a href="module-QikStorage-CookieStorageAdapter.html">CookieStorageAdapter</a><ul class='methods'><li data-type='method'><a href="module-QikStorage-CookieStorageAdapter.html#getCookieOptions">getCookieOptions</a></li><li data-type='method'><a href="module-QikStorage-CookieStorageAdapter.html#isCookieMode">isCookieMode</a></li></ul></li><li><a href="module-QikStorage-LocalStorageAdapter.html">LocalStorageAdapter</a></li><li><a href="module-QikStorage-StorageAdapter.html">StorageAdapter</a><ul class='methods'><li data-type='method'><a href="module-QikStorage-StorageAdapter.html#clearUser">clearUser</a></li><li data-type='method'><a href="module-QikStorage-StorageAdapter.html#getAccessToken">getAccessToken</a></li><li data-type='method'><a href="module-QikStorage-StorageAdapter.html#getRefreshToken">getRefreshToken</a></li><li data-type='method'><a href="module-QikStorage-StorageAdapter.html#getTokenExpiry">getTokenExpiry</a></li><li data-type='method'><a href="module-QikStorage-StorageAdapter.html#getUser">getUser</a></li><li data-type='method'><a href="module-QikStorage-StorageAdapter.html#isAvailable">isAvailable</a></li><li data-type='method'><a href="module-QikStorage-StorageAdapter.html#setUser">setUser</a></li></ul></li><li><a href="socket.html">socket</a><ul class='methods'><li data-type='method'><a href="socket.html#.channel">channel</a></li><li data-type='method'><a href="socket.html#.close">close</a></li><li data-type='method'><a href="socket.html#.connect">connect</a></li><li data-type='method'><a href="socket.html#.reconnect">reconnect</a></li><li data-type='method'><a href="socket.html#.subscribe">subscribe</a></li><li data-type='method'><a href="socket.html#.unsubscribe">unsubscribe</a></li></ul></li><li><a href="system.html">system</a><ul class='methods'><li data-type='method'><a href="system.html#.countries">countries</a></li></ul></li><li><a href="utils.html">utils</a><ul class='methods'><li data-type='method'><a href="utils.html#.cleanValue">cleanValue</a></li><li data-type='method'><a href="utils.html#.comma">comma</a></li><li data-type='method'><a href="utils.html#.errorMessage">errorMessage</a></li><li data-type='method'><a href="utils.html#.exists">exists</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#.getTypeFromID">getTypeFromID</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#.id">id</a></li><li data-type='method'><a href="utils.html#.ids">ids</a></li><li data-type='method'><a href="utils.html#.isValidEmailAddress">isValidEmailAddress</a></li><li data-type='method'><a href="utils.html#.loadExternalScript">loadExternalScript</a></li><li data-type='method'><a href="utils.html#.loadExternalStyle">loadExternalStyle</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#.parseBoolean">parseBoolean</a></li><li data-type='method'><a href="utils.html#.parseDate">parseDate</a></li><li data-type='method'><a href="utils.html#.parseEmail">parseEmail</a></li><li data-type='method'><a href="utils.html#.parseInt">parseInt</a></li><li data-type='method'><a href="utils.html#.parseNumber">parseNumber</a></li><li data-type='method'><a href="utils.html#.parseURL">parseURL</a></li></ul></li></ul><h3>Modules</h3><ul><li><a href="module-QikStorage.html">QikStorage</a><ul class='methods'><li data-type='method'><a href="module-QikStorage.html#.createStorageAdapter">createStorageAdapter</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#EventDispatcher">EventDispatcher</a></li></ul> </nav> <div id="main"> <h1 class="page-title">auth</h1> <section> <header> <h2> auth </h2> </header> <article> <h3 class="subsection-title">Methods</h3> <h4 class="name" id=".changeOrganisation"><span class="type-signature">(static) </span>changeOrganisation<span class="signature">(organisation, options)</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="qik.auth.js.html">qik.auth.js</a>, <a href="qik.auth.js.html#line131">line 131</a> </li></ul></dd> </dl> <div class="description usertext"> Manually set current user session </div> <h5>Example</h5> <pre class="prettyprint"><code>sdk.auth.changeOrganisation('61eca4746971e75c1fc670cf'); // Current user session will be automatically updated const newSession = await sdk.auth.changeOrganisation('61eca4746971e75c1fc670cf', {disableAutoAuthentication:true}); // Current user session will not be updated sdk.auth.set(newSession);</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>organisation</code></td> <td class="type"> <span class="param-type">String</span> | <span class="param-type">Object</span> </td> <td class="description last">The id of the organisation to switch into</td> </tr> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">Additional options <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>disableAutoAuthentication</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="description last">By default when switching organisation, the current user session will be updated to reflect a session in the new organisation, you can use this option to disable that behavior and instead return the user session without dispatching any events</td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <h4 class="name" id=".ensureValidToken"><span class="type-signature">(static) </span>ensureValidToken<span class="signature">(forceRefresh)</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="qik.auth.js.html">qik.auth.js</a>, <a href="qik.auth.js.html#line606">line 606</a> </li></ul></dd> </dl> <div class="description usertext"> This function forces a check to ensure that the current access token has not expired. If the token has expired, the user session will be refreshed with a new token. </div> <h5>Example</h5> <pre class="prettyprint"><code>// Check to ensure that the current access token is valid sdk.auth.ensureValidToken(); // Force the token to be refreshed, even if the current token in use has not yet expired. sdk.auth.ensureValidToken(true);</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>forceRefresh</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="description last">Whether to force the current token to be refreshed, even if it has not yet expired.</td> </tr> </tbody> </table> <h4 class="name" id=".getCurrentToken"><span class="type-signature">(static) </span>getCurrentToken<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="qik.auth.js.html">qik.auth.js</a>, <a href="qik.auth.js.html#line800">line 800</a> </li></ul></dd> </dl> <div class="description usertext"> Retrieves the current access token. If the user is authenticated the response will be the current user's access token, otherwise will fall back to the applications token. </div> <h5>Example</h5> <pre class="prettyprint"><code>const currentAccessToken = sdk.auth.getCurrentToken();</code></pre> <h4 class="name" id=".getCurrentUser"><span class="type-signature">(static) </span>getCurrentUser<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="qik.auth.js.html">qik.auth.js</a>, <a href="qik.auth.js.html#line787">line 787</a> </li></ul></dd> </dl> <div class="description usertext"> Retrieves the current user session </div> <h5>Example</h5> <pre class="prettyprint"><code>const me = sdk.auth.getCurrentUser();</code></pre> <h4 class="name" id=".impersonate"><span class="type-signature">(static) </span>impersonate<span class="signature">(persona, options)</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="qik.auth.js.html">qik.auth.js</a>, <a href="qik.auth.js.html#line190">line 190</a> </li></ul></dd> </dl> <div class="description usertext"> Impersonate another user within your organisation </div> <h5>Example</h5> <pre class="prettyprint"><code>sdk.auth.impersonate('61eca4746971e75c1fc670cf'); // Current user session will be automatically updated const newSession = await sdk.auth.impersonate('61eca4746971e75c1fc670cf', {disableAutoAuthentication:true}); // Current user session will not be updated sdk.auth.set(newSession);</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>persona</code></td> <td class="type"> <span class="param-type">String</span> | <span class="param-type">Object</span> </td> <td class="description last">The id of the user persona you want 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">Additional options <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>disableAutoAuthentication</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="description last">By default when impersonating a user, the current user session will be updated automatically to reflect the new session, you can use this option to disable that behavior and instead return the new impersonation user session without dispatching any events</td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <h4 class="name" id=".login"><span class="type-signature">(static) </span>login<span class="signature">(credentials, options)</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="qik.auth.js.html">qik.auth.js</a>, <a href="qik.auth.js.html#line255">line 255</a> </li></ul></dd> </dl> <div class="description usertext"> Login and authenticate as a user </div> <h5>Example</h5> <pre class="prettyprint"><code>const credentials = { email:'me@email.com', password:'******', mfa:'1234', } sdk.auth.login(credentials); // Current user session will be automatically updated const newSession = await sdk.auth.login(credentials, {disableAutoAuthentication:true}); // Current user session will not be updated sdk.auth.set(newSession);</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>credentials</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">The credentials used to login <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>email</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The email address to login to</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 login with</td> </tr> <tr> <td class="name"><code>mfa</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The MFA (Multi Factor Authentication) code</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">Additional options <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>disableAutoAuthentication</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="description last">By default when logging in the current user session will be updated automatically to reflect the new session, you can use this option to disable that behavior and instead return the session that was logged in to without dispatching any events</td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <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="qik.auth.js.html">qik.auth.js</a>, <a href="qik.auth.js.html#line106">line 106</a> </li></ul></dd> </dl> <div class="description usertext"> Clear the current user session from memory and erase all caches </div> <h5>Example</h5> <pre class="prettyprint"><code>sdk.auth.logout();</code></pre> <h4 class="name" id=".retrieveUserFromResetToken"><span class="type-signature">(static) </span>retrieveUserFromResetToken<span class="signature">(resetToken, options)</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="qik.auth.js.html">qik.auth.js</a>, <a href="qik.auth.js.html#line473">line 473</a> </li></ul></dd> </dl> <div class="description usertext"> Retrieve user session through use of a valid reset token, Reset tokens are short lived tokens that can be generated when a user has forgotten their password or their password has been reset by an administrator </div> <h5>Example</h5> <pre class="prettyprint"><code>const resetToken = 'XXX-324623-$$...'; // Retrieve the user session by providing a reset token const user = await sdk.auth.retrieveUserFromResetToken(resetToken);</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>resetToken</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The token to use to authenticate</td> </tr> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">Additional options for the request</td> </tr> </tbody> </table> <h4 class="name" id=".sendResetPasswordRequest"><span class="type-signature">(static) </span>sendResetPasswordRequest<span class="signature">(body)</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="qik.auth.js.html">qik.auth.js</a>, <a href="qik.auth.js.html#line562">line 562</a> </li></ul></dd> </dl> <div class="description usertext"> This function allows a reset token to be generated and emailed to the requesting user allowing them to modify their user details </div> <h5>Example</h5> <pre class="prettyprint"><code>const resetToken = 'XXX-324623-$$...'; // Retrieve the user session by providing a reset token const user = await sdk.auth.retrieveUserFromResetToken(resetToken);</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>body</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">Details for the reset 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>email</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The email of the user to generate a token for</td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <h4 class="name" id=".set"><span class="type-signature">(static) </span>set<span class="signature">(user, parameters, stopDispatch)</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="qik.auth.js.html">qik.auth.js</a>, <a href="qik.auth.js.html#line84">line 84</a> </li></ul></dd> </dl> <div class="description usertext"> Manually set current user session </div> <h5>Example</h5> <pre class="prettyprint"><code>const userSession = {_id:'61eca4746971e75c1fc670cf', firstName:'Daffy', lastName:'Duck' ...}; sdk.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>user</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">The user session object to set as the current user session</td> </tr> <tr> <td class="name"><code>parameters</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">Additional parameters to dispatch</td> </tr> <tr> <td class="name"><code>stopDispatch</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="description last">Whether to supress dispatching a 'change' event.</td> </tr> </tbody> </table> <h4 class="name" id=".sync"><span class="type-signature">(static) </span>sync<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="qik.auth.js.html">qik.auth.js</a>, <a href="qik.auth.js.html#line748">line 748</a> </li></ul></dd> </dl> <div class="description usertext"> A useful function to sync the current user session with the server. </div> <h5>Example</h5> <pre class="prettyprint"><code>// Makes request to the API and updates the current user session to match the response sdk.auth.sync();</code></pre> <h4 class="name" id=".updateUserWithToken"><span class="type-signature">(static) </span>updateUserWithToken<span class="signature">(resetToken, body, options)</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="qik.auth.js.html">qik.auth.js</a>, <a href="qik.auth.js.html#line509">line 509</a> </li></ul></dd> </dl> <div class="description usertext"> Update a user's credentials through use of a reset token </div> <h5>Example</h5> <pre class="prettyprint"><code>const resetToken = 'XXX-324623-$$...'; // Retrieve the user session by providing a reset token const user = await sdk.auth.retrieveUserFromResetToken(resetToken);</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>resetToken</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The token to use to authenticate</td> </tr> <tr> <td class="name"><code>body</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">Updates to be made to 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">Additional 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>disableAutoAuthentication</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="description last">By default the current user session will be updated automatically to reflect the new updated session, you can use this option to disable that behavior and instead return the result without dispatching any events</td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </article> </section> </div> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a> on Mon Jul 13 2026 18:49:48 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>