GT2/GT2-iOS/node_modules/auth0/docs/module-auth.DatabaseAuthent...

1747 lines
56 KiB
HTML
Raw Normal View History

2018-02-12 17:26:06 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>DatabaseAuthenticator - 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="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</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>
<li class="nav-link nav-home-link"><a href="index.html">Home</a></li><li class="nav-heading">Classes</li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="module-auth.AuthenticationClient.html">AuthenticationClient</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.AuthenticationClient.html#changePassword">changePassword</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.AuthenticationClient.html#clientCredentialsGrant">clientCredentialsGrant</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.AuthenticationClient.html#getClientInfo">getClientInfo</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.AuthenticationClient.html#getDelegationToken">getDelegationToken</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.AuthenticationClient.html#getProfile">getProfile</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.AuthenticationClient.html#passwordGrant">passwordGrant</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.AuthenticationClient.html#requestChangePasswordEmail">requestChangePasswordEmail</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.AuthenticationClient.html#requestEmailCode">requestEmailCode</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.AuthenticationClient.html#requestMagicLink">requestMagicLink</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.AuthenticationClient.html#requestSMSCode">requestSMSCode</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.AuthenticationClient.html#verifySMSCode">verifySMSCode</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="module-auth.DatabaseAuthenticator.html">DatabaseAuthenticator</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.DatabaseAuthenticator.html#changePassword">changePassword</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.DatabaseAuthenticator.html#requestChangePasswordEmail">requestChangePasswordEmail</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.DatabaseAuthenticator.html#signIn">signIn</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.DatabaseAuthenticator.html#signUp">signUp</a></span></li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="module-auth.OAuthAuthenticator.html">OAuthAuthenticator</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.OAuthAuthenticator.html#passwordGrant">passwordGrant</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.OAuthAuthenticator.html#signIn">signIn</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="module-auth.OAuthAuthenticator.html#socialSignIn">s
</nav>
<div id="main">
<h1 class="page-title">DatabaseAuthenticator</h1>
<section>
<header>
<h2>
<span class="ancestors"><a href="module-auth.html">auth</a>.</span>
DatabaseAuthenticator
</h2>
<div class="class-description"><p>Abstracts the sign-in, sign-up and change-password processes for Database &amp;
Active Directory authentication services.</p></div>
</header>
<article>
<div class="container-overview">
<div class="section-method">
<h2>Constructor</h2>
<h4 class="name" id="DatabaseAuthenticator"><span class="type-signature"></span>new DatabaseAuthenticator<span class="signature">(options, oauth)</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="auth_DatabaseAuthenticator.js.html">auth/DatabaseAuthenticator.js</a>, <a href="auth_DatabaseAuthenticator.js.html#line19">line 19</a>
</li></ul></dd>
</dl>
<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>options</code></td>
<td class="type">
<span class="param-type"><code>Object</code></span>
</td>
<td class="description last">
<p>Authenticator options.</p>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>baseUrl</code></td>
<td class="type">
<span class="param-type"><code>String</code></span>
</td>
<td class="attributes">
</td>
<td class="description last">
<p>The auth0 account URL.</p>
</td>
</tr>
<tr>
<td class="name"><code>clientId</code></td>
<td class="type">
<span class="param-type"><code>String</code></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">
<p>Default client ID.</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="name"><code>oauth</code></td>
<td class="type">
<span class="param-type"><code>OAuthAuthenticator</code></span>
</td>
<td class="description last">
<p>OAuthAuthenticator instance.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<h3 class="subsection-title">Members</h3>
<div class="section-members">
<h4 class="name" id="~clientOptions"><span class="type-signature">(inner) </span>clientOptions<span class="type-signature"> :Object</span></h4>
<div class="description">
<p>Options object for the Rest Client instace.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="auth_DatabaseAuthenticator.js.html">auth/DatabaseAuthenticator.js</a>, <a href="auth_DatabaseAuthenticator.js.html#line33">line 33</a>
</li></ul></dd>
</dl>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type"><code>Object</code></span>
</li>
</ul>
</div>
<h3 class="subsection-title">Methods</h3>
<div class="section-method">
<h4 class="name" id="changePassword"><span class="type-signature"></span>changePassword<span class="signature">(data, cb<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise|undefined}</span></h4>
<div class="description">
<p>Change password using a database or active directory service.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="auth_DatabaseAuthenticator.js.html">auth/DatabaseAuthenticator.js</a>, <a href="auth_DatabaseAuthenticator.js.html#line172">line 172</a>
</li></ul></dd>
</dl>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>data</code></td>
<td class="type">
<span class="param-type"><code>Object</code></span>
</td>
<td class="attributes">
</td>
<td class="description last">
<p>User credentials object.</p>
<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"><code>String</code></span>
</td>
<td class="description last">
<p>User email address.</p>
</td>
</tr>
<tr>
<td class="name"><code>password</code></td>
<td class="type">
<span class="param-type"><code>String</code></span>
</td>
<td class="description last">
<p>New password.</p>
</td>
</tr>
<tr>
<td class="name"><code>connection</code></td>
<td class="type">
<span class="param-type"><code>String</code></span>
</td>
<td class="description last">
<p>Identity provider in use.</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="name"><code>cb</code></td>
<td class="type">
<span class="param-type"><code>function</code></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">
<p>Method callback.</p>
</td>
</tr>
</tbody>
</table>
<div class="section-returns">
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type:
</dt>
<dd>
<span class="param-type"><code>Promise</code></span>
|
<span class="param-type"><code>undefined</code></span>
</dd>
</dl>
</div>
<div class="section-examples">
<h5>Example</h5>
<p class="code-caption">
Given the user email, the connection specified and the new password to
use, Auth0 will send a forgot password email. Once the user clicks on the
confirm password change link, the new password specified in this POST will
be set to this user. Find more information in the
<a href="https://auth0.com/docs/auth-api#!#post--dbconnections-change_password>
API Docs</a>.
</p>
<pre class="prettyprint"><code>var data = {
email: '{EMAIL}',
password: '{PASSWORD}',
connection: 'Username-Password-Authentication'
};
auth0.database.changePassword(data, function (err, message) {
if (err) {
// Handle error.
}
console.log(message);
});</code></pre>
</div>
</div>
<div class="section-method">
<h4 class="name" id="requestChangePasswordEmail"><span class="type-signature"></span>requestChangePasswordEmail<span class="signature">(data, cb<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise|undefined}</span></h4>
<div class="description">
<p>Request a change password email using a database or active directory service.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="auth_DatabaseAuthenticator.js.html">auth/DatabaseAuthenticator.js</a>, <a href="auth_DatabaseAuthenticator.js.html#line245">line 245</a>
</li></ul></dd>
</dl>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>data</code></td>
<td class="type">
<span class="param-type"><code>Object</code></span>
</td>
<td class="attributes">
</td>
<td class="description last">
<p>User credentials object.</p>
<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"><code>String</code></span>
</td>
<td class="description last">
<p>User email address.</p>
</td>
</tr>
<tr>
<td class="name"><code>connection</code></td>
<td class="type">
<span class="param-type"><code>String</code></span>
</td>
<td class="description last">
<p>Identity provider in use.</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="name"><code>cb</code></td>
<td class="type">
<span class="param-type"><code>function</code></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">
<p>Method callback.</p>
</td>
</tr>
</tbody>
</table>
<div class="section-returns">
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type:
</dt>
<dd>
<span class="param-type"><code>Promise</code></span>
|
<span class="param-type"><code>undefined</code></span>
</dd>
</dl>
</div>
<div class="section-examples">
<h5>Example</h5>
<p class="code-caption">
Given the user email, the connection specified, Auth0 will send a change
password email. once the user clicks on the confirm password change link,
the new password specified in this POST will be set to this user. Find more
information in the <a href="https://auth0.com/docs/auth-api#!#post--dbconnections-change_password>
API Docs</a>.
</p>
<pre class="prettyprint"><code>var data = {
email: '{EMAIL}',
connection: 'Username-Password-Authentication'
};
auth0.database.requestChangePasswordEmail(data, function (err, message) {
if (err) {
// Handle error.
}
console.log(message);
});</code></pre>
</div>
</div>
<div class="section-method">
<h4 class="name" id="signIn"><span class="type-signature"></span>signIn<span class="signature">(data, cb<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise|undefined}</span></h4>
<div class="description">
<p>Sign in using a database or active directory service.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="auth_DatabaseAuthenticator.js.html">auth/DatabaseAuthenticator.js</a>, <a href="auth_DatabaseAuthenticator.js.html#line43">line 43</a>
</li></ul></dd>
</dl>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>data</code></td>
<td class="type">
<span class="param-type"><code>Object</code></span>
</td>
<td class="attributes">
</td>
<td class="description last">
<p>User credentials object.</p>
<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"><code>String</code></span>
</td>
<td class="description last">
<p>Username.</p>
</td>
</tr>
<tr>
<td class="name"><code>password</code></td>
<td class="type">
<span class="param-type"><code>String</code></span>
</td>
<td class="description last">
<p>User password.</p>
</td>
</tr>
<tr>
<td class="name"><code>connection</code></td>
<td class="type">
<span class="param-type"><code>String</code></span>
</td>
<td class="description last">
<p>Identity provider in use.</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="name"><code>cb</code></td>
<td class="type">
<span class="param-type"><code>function</code></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">
<p>Method callback.</p>
</td>
</tr>
</tbody>
</table>
<div class="section-returns">
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type:
</dt>
<dd>
<span class="param-type"><code>Promise</code></span>
|
<span class="param-type"><code>undefined</code></span>
</dd>
</dl>
</div>
<div class="section-examples">
<h5>Example</h5>
<p class="code-caption">
Given the user credentials and the connection specified, it will do the
authentication on the provider and return a JSON with the `access_token`
and `id_token`. Find more information about the structure of the data
object in the <a href="https://auth0.com/docs/auth-api#!#post--oauth-ro">
API docs</a>.
</p>
<pre class="prettyprint"><code>var data = {
username: '{USERNAME}',
password: '{PASSWORD}',
connection: 'Username-Password-Authentication' // Optional field.
};
auth0.database.signIn(data, function (err, userData) {
if (err) {
// Handle error.
}
console.log(userData);
});</code></pre>
</div>
</div>
<div class="section-method">
<h4 class="name" id="signUp"><span class="type-signature"></span>signUp<span class="signature">(data, cb<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise|undefined}</span></h4>
<div class="description">
<p>Sign up using a database or active directory service.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="auth_DatabaseAuthenticator.js.html">auth/DatabaseAuthenticator.js</a>, <a href="auth_DatabaseAuthenticator.js.html#line102">line 102</a>
</li></ul></dd>
</dl>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>data</code></td>
<td class="type">
<span class="param-type"><code>Object</code></span>
</td>
<td class="attributes">
</td>
<td class="description last">
<p>User credentials object.</p>
<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"><code>String</code></span>
</td>
<td class="description last">
<p>User email address.</p>
</td>
</tr>
<tr>
<td class="name"><code>password</code></td>
<td class="type">
<span class="param-type"><code>String</code></span>
</td>
<td class="description last">
<p>User password.</p>
</td>
</tr>
<tr>
<td class="name"><code>connection</code></td>
<td class="type">
<span class="param-type"><code>Stinrg</code></span>
</td>
<td class="description last">
<p>Identity provider in use.</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="name"><code>cb</code></td>
<td class="type">
<span class="param-type"><code>function</code></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">
<p>Method callback.</p>
</td>
</tr>
</tbody>
</table>
<div class="section-returns">
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type:
</dt>
<dd>
<span class="param-type"><code>Promise</code></span>
|
<span class="param-type"><code>undefined</code></span>
</dd>
</dl>
</div>
<div class="section-examples">
<h5>Example</h5>
<p class="code-caption">
Given the user credentials, the connection specified and (optionally) the
client ID, it will create a new user. Find more information in the
<a href="https://auth0.com/docs/auth-api#!#post--dbconnections-signup">
API Docs</a>.
</p>
<pre class="prettyprint"><code>var data = {
email: '{EMAIL}',
password: '{PASSWORD}',
connection: 'Username-Password-Authentication' // Optional field.
};
auth0.database.signUp(data, function (err, userData) {
if (err) {
// Handle error.
}
console.log(userData);
});</code></pre>
</div>
</div>
</article>
</section>
</div>
<br class="clear">
<footer>
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Fri Dec 08 2017 10:01:22 GMT-0300 (-03) using the Minami theme.
</footer>
<script>prettyPrint();</script>
<script src="scripts/linenumber.js"></script>
</body>
</html>