GT2/GT2-Android/node_modules/auth0/docs/module-auth.PasswordlessAut...

1445 lines
51 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>PasswordlessAuthenticator - 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">PasswordlessAuthenticator</h1>
<section>
<header>
<h2>
<span class="ancestors"><a href="module-auth.html">auth</a>.</span>
PasswordlessAuthenticator
</h2>
<div class="class-description"><p>Handles authenticator with passwordless flows, e.g. SMS, Touch ID, etc.</p></div>
</header>
<article>
<div class="container-overview">
<div class="section-method">
<h2>Constructor</h2>
<h4 class="name" id="PasswordlessAuthenticator"><span class="type-signature"></span>new PasswordlessAuthenticator<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_PasswordlessAuthenticator.js.html">auth/PasswordlessAuthenticator.js</a>, <a href="auth_PasswordlessAuthenticator.js.html#line18">line 18</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_PasswordlessAuthenticator.js.html">auth/PasswordlessAuthenticator.js</a>, <a href="auth_PasswordlessAuthenticator.js.html#line32">line 32</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="sendEmail"><span class="type-signature"></span>sendEmail<span class="signature">(userData, cb<span class="signature-attributes">opt</span>)</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_PasswordlessAuthenticator.js.html">auth/PasswordlessAuthenticator.js</a>, <a href="auth_PasswordlessAuthenticator.js.html#line110">line 110</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>userData</code></td>
<td class="type">
<span class="param-type"><code>Object</code></span>
</td>
<td class="attributes">
</td>
<td class="description last">
<p>User account data.</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>send</code></td>
<td class="type">
<span class="param-type"><code>String</code></span>
</td>
<td class="description last">
<p>The type of email to be sent.</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` address, it will send an email with:
<ul>
<li>A link (default, `send:"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.
</li>
<li>
A verification code (`send:"code"`). You can then authenticate with
this user using the `/oauth/ro` endpoint specifying `email` as
`username` and `code` as `password`.
</li>
</ul>
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}',
send: 'link',
authParams: {} // Optional auth params.
};
auth0.passwordless.sendEmail(data, function (err) {
if (err) {
// Handle error.
}
});</code></pre>
</div>
</div>
<div class="section-method">
<h4 class="name" id="sendSMS"><span class="type-signature"></span>sendSMS<span class="signature">(userData, cb<span class="signature-attributes">opt</span>)</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_PasswordlessAuthenticator.js.html">auth/PasswordlessAuthenticator.js</a>, <a href="auth_PasswordlessAuthenticator.js.html#line186">line 186</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>userData</code></td>
<td class="type">
<span class="param-type"><code>Object</code></span>
</td>
<td class="attributes">
</td>
<td class="description last">
<p>User account data.</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>phone_number</code></td>
<td class="type">
<span class="param-type"><code>String</code></span>
</td>
<td class="attributes">
</td>
<td class="description last">
<p>User phone number.</p>
</td>
</tr>
<tr>
<td class="name"><code>client_id</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>Client ID.</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 `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.passwordless.sendSMS(data, function (err) {
if (err) {
// Handle error.
}
});</code></pre>
</div>
</div>
<div class="section-method">
<h4 class="name" id="signIn"><span class="type-signature"></span>signIn<span class="signature">(userData, cb<span class="signature-attributes">opt</span>)</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_PasswordlessAuthenticator.js.html">auth/PasswordlessAuthenticator.js</a>, <a href="auth_PasswordlessAuthenticator.js.html#line42">line 42</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>userData</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>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>Password.</p>
</td>
</tr>
<tr>
<td class="name"><code>client_id</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>Client ID.</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>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.passwordless.signIn(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>