UNPKG

react-native-auth0

Version:
704 lines (597 loc) 23.9 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width,initial-scale=1" /> <title>WebAuth - 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="Auth.html">Auth</a></span> </li> <li class="nav-item"> <span class="nav-item-type type-function">F</span ><span class="nav-item-name" ><a href="Auth.html#.authorizeUrl">authorizeUrl</a></span > </li> <li class="nav-item"> <span class="nav-item-type type-function">F</span ><span class="nav-item-name" ><a href="Auth.html#.createUser">createUser</a></span > </li> <li class="nav-item"> <span class="nav-item-type type-function">F</span ><span class="nav-item-name" ><a href="Auth.html#.exchange">exchange</a></span > </li> <li class="nav-item"> <span class="nav-item-type type-function">F</span ><span class="nav-item-name" ><a href="Auth.html#.exchangeNativeSocial" >exchangeNativeSocial</a ></span > </li> <li class="nav-item"> <span class="nav-item-type type-function">F</span ><span class="nav-item-name" ><a href="Auth.html#.loginWithEmail">loginWithEmail</a></span > </li> <li class="nav-item"> <span class="nav-item-type type-function">F</span ><span class="nav-item-name" ><a href="Auth.html#.loginWithSMS">loginWithSMS</a></span > </li> <li class="nav-item"> <span class="nav-item-type type-function">F</span ><span class="nav-item-name" ><a href="Auth.html#.logoutUrl">logoutUrl</a></span > </li> <li class="nav-item"> <span class="nav-item-type type-function">F</span ><span class="nav-item-name" ><a href="Auth.html#.passwordlessWithEmail" >passwordlessWithEmail</a ></span > </li> <li class="nav-item"> <span class="nav-item-type type-function">F</span ><span class="nav-item-name" ><a href="Auth.html#.passwordlessWithSMS" >passwordlessWithSMS</a ></span > </li> <li class="nav-item"> <span class="nav-item-type type-function">F</span ><span class="nav-item-name" ><a href="Auth.html#.passwordRealm">passwordRealm</a></span > </li> <li class="nav-item"> <span class="nav-item-type type-function">F</span ><span class="nav-item-name" ><a href="Auth.html#.refreshToken">refreshToken</a></span > </li> <li class="nav-item"> <span class="nav-item-type type-function">F</span ><span class="nav-item-name" ><a href="Auth.html#.resetPassword">resetPassword</a></span > </li> <li class="nav-item"> <span class="nav-item-type type-function">F</span ><span class="nav-item-name" ><a href="Auth.html#.revoke">revoke</a></span > </li> <li class="nav-item"> <span class="nav-item-type type-function">F</span ><span class="nav-item-name" ><a href="Auth.html#.userInfo">userInfo</a></span > </li> <li class="nav-heading"> <span class="nav-item-type type-class">C</span ><span class="nav-item-name"><a href="Auth0.html">Auth0</a></span> </li> <li class="nav-heading"> <span class="nav-item-type type-class">C</span ><span class="nav-item-name" ><a href="Auth0.module.exports.html">module.exports</a></span > </li> <li class="nav-heading"> <span class="nav-item-type type-class">C</span ><span class="nav-item-name"><a href="Users.html">Users</a></span> </li> <li class="nav-item"> <span class="nav-item-type type-function">F</span ><span class="nav-item-name" ><a href="Users.html#.getUser">getUser</a></span > </li> <li class="nav-item"> <span class="nav-item-type type-function">F</span ><span class="nav-item-name" ><a href="Users.html#.patchUser">patchUser</a></span > </li> <li class="nav-heading"> <span class="nav-item-type type-class">C</span ><span class="nav-item-name"><a href="WebAuth.html">WebAuth</a></span> </li> <li class="nav-item"> <span class="nav-item-type type-function">F</span ><span class="nav-item-name" ><a href="WebAuth.html#.authorize">authorize</a></span > </li> <li class="nav-item"> <span class="nav-item-type type-function">F</span ><span class="nav-item-name" ><a href="WebAuth.html#.clearSession">clearSession</a></span > </li> <li class="nav-heading"><a href="global.html">Globals</a></li> <li class="nav-item"> <span class="nav-item-type type-function">F</span ><span class="nav-item-name" ><a href="global.html#users">users</a></span > </li> </nav> <div id="main"> <h1 class="page-title">WebAuth</h1> <section> <header> <h2> WebAuth </h2> </header> <article> <div class="container-overview"> <div class="section-method"> <h4 class="name" id="WebAuth"> <span class="type-signature"></span>new WebAuth<span class="signature" >()</span ><span class="type-signature"></span> </h4> <div class="description"> <p>Helper to perform Auth against Auth0 hosted login page</p> <p> It will use <code>/authorize</code> endpoint of the Authorization Server (AS) with Code Grant and Proof Key for Challenge Exchange (PKCE). </p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="src_webauth_index.js.html" >src/webauth/index.js</a >, <a href="src_webauth_index.js.html#line23">line 23</a> </li> </ul> </dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li> <a href="https://auth0.com/docs/api-auth/grant/authorization-code-pkce" >https://auth0.com/docs/api-auth/grant/authorization-code-pkce</a > </li> </ul> </dd> </dl> </div> </div> <h3 class="subsection-title">Methods</h3> <div class="section-method"> <h4 class="name" id=".authorize"> <span class="type-signature">(static) </span>authorize<span class="signature" >(parameters, options)</span ><span class="type-signature"> &rarr; {Promise}</span> </h4> <div class="description"> <p> Starts the AuthN/AuthZ transaction against the AS in the in-app browser. </p> <p> In iOS it will use <code>SFSafariViewController</code> and in Android Chrome Custom Tabs. </p> <p> To learn more about how to customize the authorize call, check the Universal Login Page article at https://auth0.com/docs/hosted-pages/login </p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="src_webauth_index.js.html">src/webauth/index.js</a >, <a href="src_webauth_index.js.html#line68">line 68</a> </li> </ul> </dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li> <a href="https://auth0.com/docs/api/authentication#authorize-client" >https://auth0.com/docs/api/authentication#authorize-client</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>parameters</code></td> <td class="type"> <span class="param-type"><code>Object</code></span> </td> <td class="description last"> <p>Parameters to send on the AuthN/AuthZ request.</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>state</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> Random string to prevent CSRF attacks and used to discard unexepcted results. By default its a cryptographically secure random. </p> </td> </tr> <tr> <td class="name"><code>nonce</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> Random string to prevent replay attacks of id_tokens. </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> Identifier of Resource Server (RS) to be included as audience (aud claim) of the issued access token </p> </td> </tr> <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 requested for the issued tokens. e.g. <code>openid profile</code> </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="attributes">&lt;optional><br /></td> <td class="description last"> <p> The name of the identity provider to use, e.g. &quot;google-oauth2&quot; or &quot;facebook&quot;. When not set, it will display Auth0's Universal Login Page. </p> </td> </tr> <tr> <td class="name"><code>max_age</code></td> <td class="type"> <span class="param-type"><code>Number</code></span> </td> <td class="attributes">&lt;optional><br /></td> <td class="description last"> <p> The allowable elapsed time in seconds since the last time the user was authenticated (optional). </p> </td> </tr> <tr> <td class="name"><code>organization</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>the ID of the organization to join</p> </td> </tr> <tr> <td class="name"><code>invitationUrl</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> the invitation URL to join an organization. Takes precedence over the &quot;organization&quot; parameter. </p> </td> </tr> </tbody> </table> </td> </tr> <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>Other configuration 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>leeway</code></td> <td class="type"> <span class="param-type"><code>Number</code></span> </td> <td class="attributes">&lt;optional><br /></td> <td class="description last"> <p> The amount of leeway, in seconds, to accommodate potential clock skew when validating an ID token's claims. Defaults to 60 seconds if not specified. </p> </td> </tr> <tr> <td class="name"><code>ephemeralSession</code></td> <td class="type"> <span class="param-type"><code>Boolean</code></span> </td> <td class="attributes">&lt;optional><br /></td> <td class="description last"> <p> Disable Single-Sign-On (SSO). It only affects iOS with versions 13 and above. </p> </td> </tr> <tr> <td class="name"><code>customScheme</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>Custom scheme to build the callback URL with.</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> </dd> </dl> </div> </div> <div class="section-method"> <h4 class="name" id=".clearSession"> <span class="type-signature">(static) </span>clearSession<span class="signature" >(parameters)</span ><span class="type-signature"> &rarr; {Promise}</span> </h4> <div class="description"> <p> Removes Auth0 session and optionally remove the Identity Provider session. </p> <p> In iOS it will use <code>SFSafariViewController</code> and in Android Chrome Custom Tabs. </p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"> <ul class="dummy"> <li> <a href="src_webauth_index.js.html">src/webauth/index.js</a >, <a href="src_webauth_index.js.html#line155">line 155</a> </li> </ul> </dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li> <a href="https://auth0.com/docs/logout" >https://auth0.com/docs/logout</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>parameters</code></td> <td class="type"> <span class="param-type"><code>Object</code></span> </td> <td class="description last"> <p>Parameters to send</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>federated</code></td> <td class="type"> <span class="param-type"><code>Bool</code></span> </td> <td class="attributes">&lt;optional><br /></td> <td class="description last"> <p>Optionally remove the IdP session.</p> </td> </tr> <tr> <td class="name"><code>customScheme</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>Custom scheme to build the callback URL with.</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> </dd> </dl> </div> </div> </article> </section> </div> <br class="clear" /> <footer> Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a> on Tue Jun 22 2021 14:24:13 GMT-0300 (Argentina Standard Time) using the Minami theme. </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"></script> </body> </html>