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

3631 lines
78 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>AuthenticationClient - 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">AuthenticationClient</h1>
<section>
<header>
<h2>
<span class="ancestors"><a href="module-auth.html">auth</a>.</span>
AuthenticationClient
</h2>
<div class="class-description"><p>Authentication API SDK.</p>
<p>This client must used to access Auth0's
<a href="https://auth0.com/docs/auth-api">Authentication API</a>.</p></div>
</header>
<article>
<div class="container-overview">
<div class="section-method">
<h2>Constructor</h2>
<h4 class="name" id="AuthenticationClient"><span class="type-signature"></span>new AuthenticationClient<span class="signature">(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="auth_index.js.html">auth/index.js</a>, <a href="auth_index.js.html#line49">line 49</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>Options for the Authentication Client
SDK.</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>domain</code></td>
<td class="type">
<span class="param-type"><code>String</code></span>
</td>
<td class="attributes">
</td>
<td class="description last">
<p>AuthenticationClient server domain.</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>
<tr>
<td class="name"><code>clientSecret</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 Secret.</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<div class="section-examples">
<h5>Example</h5>
<p class="code-caption">
The <b>AuthenticationClient</b> constructor takes an <i>optional</i> client
ID, if specified it will be used as default value for all endpoints that
accept a client ID.
</p>
<pre class="prettyprint"><code>var AuthenticationClient = require('auth0'). AuthenticationClient;
var auth0 = new AuthenticationClient({
domain: '{YOUR_ACCOUNT}.auth0.com',
clientId: '{OPTIONAL_CLIENT_ID}'
});</code></pre>
</div>
</div>
</div>
<h3 class="subsection-title">Members</h3>
<div class="section-members">
<h4 class="name" id="database"><span class="type-signature"></span>database<span class="type-signature"> :DatabaseAuthenticator</span></h4>
<div class="description">
<p>Database authenticator.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="auth_index.js.html">auth/index.js</a>, <a href="auth_index.js.html#line88">line 88</a>
</li></ul></dd>
</dl>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type"><code>DatabaseAuthenticator</code></span>
</li>
</ul>
</div>
<div class="section-members">
<h4 class="name" id="oauth"><span class="type-signature"></span>oauth<span class="type-signature"> :OAuthAuthenticator</span></h4>
<div class="description">
<p>OAuth authenticator.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="auth_index.js.html">auth/index.js</a>, <a href="auth_index.js.html#line81">line 81</a>
</li></ul></dd>
</dl>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type"><code>OAuthAuthenticator</code></span>
</li>
</ul>
</div>
<div class="section-members">
<h4 class="name" id="passwordless"><span class="type-signature"></span>passwordless<span class="type-signature"> :PasswordlessAuthenticator</span></h4>
<div class="description">
<p>Passwordless authenticator.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="auth_index.js.html">auth/index.js</a>, <a href="auth_index.js.html#line95">line 95</a>
</li></ul></dd>
</dl>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type"><code>PasswordlessAuthenticator</code></span>
</li>
</ul>
</div>
<div class="section-members">
<h4 class="name" id="tokens"><span class="type-signature"></span>tokens<span class="type-signature"> :TokensManager</span></h4>
<div class="description">
<p>Tokens manager.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="auth_index.js.html">auth/index.js</a>, <a href="auth_index.js.html#line109">line 109</a>
</li></ul></dd>
</dl>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type"><code>TokensManager</code></span>
</li>
</ul>
</div>
<div class="section-members">
<h4 class="name" id="users"><span class="type-signature"></span>users<span class="type-signature"> :UsersManager</span></h4>
<div class="description">
<p>Users manager.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="auth_index.js.html">auth/index.js</a>, <a href="auth_index.js.html#line102">line 102</a>
</li></ul></dd>
</dl>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type"><code>UsersManager</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)</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_index.js.html">auth/index.js</a>, <a href="auth_index.js.html#line366">line 366</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>data</code></td>
<td class="type">
<span class="param-type"><code>Object</code></span>
</td>
<td class="description last">
<p>User data 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.</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 for the user.</p>
</td>
</tr>
</tbody>
</table>
</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.changePassword(data, function (err, message) {
if (err) {
// Handle error.
}
console.log(message);
});</code></pre>
</div>
</div>
<div class="section-method">
<h4 class="name" id="clientCredentialsGrant"><span class="type-signature"></span>clientCredentialsGrant<span class="signature">(options)</span><span class="type-signature"> &rarr; {Promise|undefined}</span></h4>
<div class="description">
<p>Gets an access token using the client credentials grant flow.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="auth_index.js.html">auth/index.js</a>, <a href="auth_index.js.html#line482">line 482</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">
<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>scope</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>scopes to request to be added to the returned access token</p>
</td>
</tr>
<tr>
<td class="name"><code>audience</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>audience or identifier of the API where the access token will be used, e.g. Auth0 Management API</p>
</td>
</tr>
</tbody>
</table>
</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">
Gets an access token using the client credentials grant flow. Find more information in the
<a href="https://auth0.com/docs/api-auth/config/asking-for-access-tokens">API Docs</a>.
</p>
<pre class="prettyprint"><code>auth0.clientCredentialsGrant({
audience: 'https://tenant.auth0.com/api/v2/',
scope: 'read:users update:users'
}, function (err, response) {
if (err) {
// Handle error.
}
console.log(response);
});</code></pre>
</div>
</div>
<div class="section-method">
<h4 class="name" id="getClientInfo"><span class="type-signature"></span>getClientInfo<span class="signature">()</span><span class="type-signature"> &rarr; {Object}</span></h4>
<div class="description">
<p>Return an object with information about the current client,</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="auth_index.js.html">auth/index.js</a>, <a href="auth_index.js.html#line113">line 113</a>
</li></ul></dd>
</dl>
<div class="section-returns">
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type:
</dt>
<dd>
<span class="param-type"><code>Object</code></span>
</dd>
</dl>
<div class="param-desc">
<p>Object containing client information.</p>
</div>
</div>
</div>
<div class="section-method">
<h4 class="name" id="getDelegationToken"><span class="type-signature"></span>getDelegationToken<span class="signature">(data)</span><span class="type-signature"> &rarr; {Promise|undefined}</span></h4>
<div class="description">
<p>Exchange the token of the logged in user with a token that is valid to call
the API (signed with the API secret).</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="auth_index.js.html">auth/index.js</a>, <a href="auth_index.js.html#line315">line 315</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>data</code></td>
<td class="type">
<span class="param-type"><code>Object</code></span>
</td>
<td class="description last">
<p>Token data 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>id_token</code></td>
<td class="type">
<span class="param-type"><code>String</code></span>
</td>
<td class="description last">
<p>The user ID token.</p>
</td>
</tr>
<tr>
<td class="name"><code>api_type</code></td>
<td class="type">
<span class="param-type"><code>String</code></span>
</td>
<td class="description last">
<p>The API type (aws, firebase, etc).</p>
</td>
</tr>
<tr>
<td class="name"><code>target</code></td>
<td class="type">
<span class="param-type"><code>String</code></span>
</td>
<td class="description last">
<p>The target client ID.</p>
</td>
</tr>
<tr>
<td class="name"><code>grant_type</code></td>
<td class="type">
<span class="param-type"><code>String</code></span>
</td>
<td class="description last">
<p>The grant type.</p>
</td>
</tr>
</tbody>
</table>
</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 an existing token, this endpoint will generate a new token signed
with the target client secret. This is used to flow the identity of the
user from the application to an API or across different APIs that are
protected with different secrets. Find more information in the
<a href="https://auth0.com/docs/auth-api#!#post--delegation">API Docs</a>.
</p>
<pre class="prettyprint"><code>var data = {
id_token: '{ID_TOKEN}',
api_type: 'app',
target: '{TARGET}',
grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer'
};
auth0.getDelegationToken(data, function (err, token) {
if (err) {
// Handle error.
}
console.log(token);
});</code></pre>
</div>
</div>
<div class="section-method">
<h4 class="name" id="getProfile"><span class="type-signature"></span>getProfile<span class="signature">(accessToken)</span><span class="type-signature"> &rarr; {Promise|undefined}</span></h4>
<div class="description">
<p>Given an access token get the user profile linked to it.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="auth_index.js.html">auth/index.js</a>, <a href="auth_index.js.html#line456">line 456</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>accessToken</code></td>
<td class="type">
<span class="param-type"><code>String</code></span>
</td>
<td class="description last">
<p>The user access token.</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">
Get the user information based on the Auth0 access token (obtained during
login). Find more information in the
<a href="https://auth0.com/docs/auth-api#!#get--userinfo">API Docs</a>.
</p>
<pre class="prettyprint"><code>auth0.getProfile(data, function (err, userInfo) {
if (err) {
// Handle error.
}
console.log(userInfo);
});</code></pre>
</div>
</div>
<div class="section-method">
<h4 class="name" id="passwordGrant"><span class="type-signature"></span>passwordGrant<span class="signature">(userData)</span><span class="type-signature"> &rarr; {Promise|undefined}</span></h4>
<div class="description">
<p>Sign in using a username and password</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="auth_index.js.html">auth/index.js</a>, <a href="auth_index.js.html#line512">line 512</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>userData</code></td>
<td class="type">
<span class="param-type"><code>Object</code></span>
</td>
<td class="description last">
<p>User credentials object.</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>username</code></td>
<td class="type">
<span class="param-type"><code>String</code></span>
</td>
<td class="attributes">
</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="attributes">
</td>
<td class="description last">
<p>User password.</p>
</td>
</tr>
<tr>
<td class="name"><code>realm</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>Name of the realm to use to authenticate or the connection name</p>
</td>
</tr>
</tbody>
</table>
</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's credentials perform the OAuth password grant
or Password Realm grant if a realm is provided,
it will return a JSON with the access_token and id_token.
More information in the
<a href="https://auth0.com/docs/api/authentication#resource-owner-password">
API Docs
</a>.
</p>
<pre class="prettyprint"><code>var data = {
client_id: '{CLIENT_ID}', // Optional field.
username: '{USERNAME}',
password: '{PASSWORD}'
realm: '{CONNECTION_NAME}', // Optional field.
scope: 'openid' // Optional field.
};
auth0.oauth.token(data, function (err, userData) {
if (err) {
// Handle error.
}
console.log(userData);
});</code></pre>
</div>
</div>
<div class="section-method">
<h4 class="name" id="requestChangePasswordEmail"><span class="type-signature"></span>requestChangePasswordEmail<span class="signature">(data)</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_index.js.html">auth/index.js</a>, <a href="auth_index.js.html#line413">line 413</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>data</code></td>
<td class="type">
<span class="param-type"><code>Object</code></span>
</td>
<td class="description last">
<p>User data 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.</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 for the user.</p>
</td>
</tr>
</tbody>
</table>
</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.requestChangePasswordEmail(data, function (err, message) {
if (err) {
// Handle error.
}
console.log(message);
});</code></pre>
</div>
</div>
<div class="section-method">
<h4 class="name" id="requestEmailCode"><span class="type-signature"></span>requestEmailCode<span class="signature">(data)</span><span class="type-signature"> &rarr; {Promise|undefined}</span></h4>
<div class="description">
<p>Start passwordless flow sending an email.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="auth_index.js.html">auth/index.js</a>, <a href="auth_index.js.html#line187">line 187</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>data</code></td>
<td class="type">
<span class="param-type"><code>Object</code></span>
</td>
<td class="description last">
<p>User data object.</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>email</code></td>
<td class="type">
<span class="param-type"><code>String</code></span>
</td>
<td class="attributes">
</td>
<td class="description last">
<p>User email address.</p>
</td>
</tr>
<tr>
<td class="name"><code>authParams</code></td>
<td class="type">
<span class="param-type"><code>Object</code></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">
<p>Authentication parameters.</p>
</td>
</tr>
</tbody>
</table>
</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` address, it will send an email with a verification
code. You can then authenticate with this user using the `/oauth/ro`
endpoint using the email as username and the code as password.
Find more information in the
<a href="https://auth0.com/docs/auth-api#!#post--with_email">API Docs</a>
</p>
<pre class="prettyprint"><code>var data = {
email: '{EMAIL}',
authParams: {} // Optional auth params.
};
auth0.requestEmailCode(data, function (err) {
if (err) {
// Handle error.
}
};</code></pre>
</div>
</div>
<div class="section-method">
<h4 class="name" id="requestMagicLink"><span class="type-signature"></span>requestMagicLink<span class="signature">(data)</span><span class="type-signature"> &rarr; {Promise|undefined}</span></h4>
<div class="description">
<p>Start passwordless flow sending an email.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="auth_index.js.html">auth/index.js</a>, <a href="auth_index.js.html#line146">line 146</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>data</code></td>
<td class="type">
<span class="param-type"><code>Object</code></span>
</td>
<td class="description last">
<p>User data object.</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>email</code></td>
<td class="type">
<span class="param-type"><code>String</code></span>
</td>
<td class="attributes">
</td>
<td class="description last">
<p>User email address.</p>
</td>
</tr>
<tr>
<td class="name"><code>authParams</code></td>
<td class="type">
<span class="param-type"><code>Object</code></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">
<p>Authentication parameters.</p>
</td>
</tr>
</tbody>
</table>
</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` address, it will send an email with a link. You can
then authenticate with this user opening the link and he will be
automatically logged in to the application. Optionally, you can
append/override parameters to the link (like `scope`, `redirect_uri`,
`protocol`, `response_type`, etc.) using `authParams` object.
Find more information in the
<a href="https://auth0.com/docs/auth-api#!#post--with_email">API Docs</a>
</p>
<pre class="prettyprint"><code>var data = {
email: '{EMAIL}',
authParams: {} // Optional auth params.
};
auth0.requestMagicLink(data, function (err) {
if (err) {
// Handle error.
}
};</code></pre>
</div>
</div>
<div class="section-method">
<h4 class="name" id="requestSMSCode"><span class="type-signature"></span>requestSMSCode<span class="signature">(data)</span><span class="type-signature"> &rarr; {Promise|undefined}</span></h4>
<div class="description">
<p>Start passwordless flow sending an SMS.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="auth_index.js.html">auth/index.js</a>, <a href="auth_index.js.html#line226">line 226</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>data</code></td>
<td class="type">
<span class="param-type"><code>Object</code></span>
</td>
<td class="description last">
<p>User data 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>phone_number</code></td>
<td class="type">
<span class="param-type"><code>String</code></span>
</td>
<td class="description last">
<p>The user phone number.</p>
</td>
</tr>
</tbody>
</table>
</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 `phone_number`, it will send a SMS message with a
verification code. You can then authenticate with this user using the
`/oauth/ro` endpoint specifying `phone_number` as `username` and `code` as
`password`:
</p>
<pre class="prettyprint"><code>var data = {
phone_number: '{PHONE}'
};
auth0.requestSMSCode(data, function (err) {
if (err) {
// Handle error.
}
});</code></pre>
</div>
</div>
<div class="section-method">
<h4 class="name" id="verifySMSCode"><span class="type-signature"></span>verifySMSCode<span class="signature">(data)</span><span class="type-signature"> &rarr; {Promise|undefined}</span></h4>
<div class="description">
<p>Sign in with the given user credentials.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="auth_index.js.html">auth/index.js</a>, <a href="auth_index.js.html#line264">line 264</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>data</code></td>
<td class="type">
<span class="param-type"><code>Object</code></span>
</td>
<td class="description last">
<p>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>Phone number.</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>Verification code.</p>
</td>
</tr>
<tr>
<td class="name"><code>target</code></td>
<td class="type">
<span class="param-type"><code>String</code></span>
</td>
<td class="description last">
<p>Target client ID.</p>
</td>
</tr>
<tr>
<td class="name"><code>grant_type</code></td>
<td class="type">
<span class="param-type"><code>String</code></span>
</td>
<td class="description last">
<p>Grant type.</p>
</td>
</tr>
</tbody>
</table>
</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>Examples</h5>
<p class="code-caption">
Given the user credentials (`phone_number` and `code`), it will do the
authentication on the provider and return a JSON with the `access_token`
and `id_token`.
</p>
<pre class="prettyprint"><code>var data = {
username: '{PHONE_NUMBER}',
password: '{VERIFICATION_CODE}'
};
auth0.verifySMSCode(data, function (err) {
if (err) {
// Handle error.
}
});</code></pre>
<p class="code-caption">
The user data object has the following structure.
</p>
<pre class="prettyprint"><code>{
id_token: String,
access_token: String,
token_type: String
}</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>