157 lines
39 KiB
HTML
157 lines
39 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html lang="en">
|
||
|
<head>
|
||
|
<meta charset="utf-8">
|
||
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||
|
<title>Home - 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">
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<section class="readme">
|
||
|
<article><h1>node-auth0</h1><p><a href="https://circleci.com/gh/auth0/node-auth0"><img src="http://img.shields.io/circleci/project/github/auth0/node-auth0.svg?branch=master&style=flat-square" alt="Build Status"></a>
|
||
|
<a href="https://npmjs.org/package/auth0"><img src="https://img.shields.io/npm/v/auth0.svg?style=flat-square" alt="NPM version"></a>
|
||
|
<a href="https://codecov.io/github/auth0/node-auth0?branch=master"><img src="https://img.shields.io/codecov/c/github/auth0/node-auth0.svg?style=flat-square" alt="Coverage"></a>
|
||
|
<a href="#license"><img src="http://img.shields.io/npm/l/auth0.svg?style=flat-square" alt="License"></a>
|
||
|
<a href="https://npmjs.org/package/auth0"><img src="http://img.shields.io/npm/dm/auth0.svg?style=flat-square" alt="Downloads"></a></p>
|
||
|
<p>Node.js client library for the <a href="https://auth0.com">Auth0</a> platform.</p>
|
||
|
<h2>Installation</h2><pre class="prettyprint source lang-bash"><code> npm install auth0</code></pre><h2>Authentication API Client</h2><p>This client must be used to access Auth0's <a href="https://auth0.com/docs/auth-api">Authentication API</a>.</p>
|
||
|
<p>The <strong>AuthenticationClient</strong> constructor takes an <em>optional</em> client ID, if specified it will be used as default value for all endpoints that accept a client ID.</p>
|
||
|
<pre class="prettyprint source lang-js"><code>var AuthenticationClient = require('auth0').AuthenticationClient;
|
||
|
|
||
|
var auth0 = new AuthenticationClient({
|
||
|
domain: '{YOUR_ACCOUNT}.auth0.com',
|
||
|
clientId: '{OPTIONAL_CLIENT_ID}'
|
||
|
});</code></pre><h2>Management API Client</h2><p>The Auth0 Management API is meant to be used by back-end servers or trusted parties performing administrative tasks. Generally speaking, anything that can be done through the Auth0 dashboard (and more) can also be done through this API.</p>
|
||
|
<p>Initialize your client class with an API v2 token and a domain.</p>
|
||
|
<pre class="prettyprint source lang-js"><code>var ManagementClient = require('auth0').ManagementClient;
|
||
|
|
||
|
var management = new ManagementClient({
|
||
|
token: '{YOUR_API_V2_TOKEN}',
|
||
|
domain: '{YOUR_ACCOUNT}.auth0.com'
|
||
|
});</code></pre><blockquote>
|
||
|
<p>Note: When using at browser you should use <code>telemetry: false</code>.</p>
|
||
|
</blockquote>
|
||
|
<p>To obtain <strong>automatically</strong> a Management API token via the ManagementClient, you can specify the parameters <code>clientId</code>, <code>clientSecret</code> (use a Non Interactive Client) and optionally <code>scope</code>.
|
||
|
Behind the scenes the Client Credentials Grant is used to obtain the <code>access_token</code> and is by default cached for the duration of the returned <code>expires_in</code> value.</p>
|
||
|
<pre class="prettyprint source lang-js"><code>var ManagementClient = require('auth0').ManagementClient;
|
||
|
var auth0 = new ManagementClient({
|
||
|
domain: '{YOUR_ACCOUNT}.auth0.com',
|
||
|
clientId: '{YOUR_NON_INTERACTIVE_CLIENT_ID}',
|
||
|
clientSecret: '{YOUR_NON_INTERACTIVE_CLIENT_SECRET}',
|
||
|
scope: "read:users write:users",
|
||
|
});</code></pre><blockquote>
|
||
|
<p>Make sure your ClientId is allowed to request tokens from Management API in <a href="https://manage.auth0.com/#/apis">Auth0 Dashboard</a></p>
|
||
|
</blockquote>
|
||
|
<p>To obtain a Management API token from your node backend, you can use Client Credentials Grant using your registered Auth0 Non Interactive Clients</p>
|
||
|
<pre class="prettyprint source lang-js"><code>var AuthenticationClient = require('auth0').AuthenticationClient;
|
||
|
|
||
|
var auth0 = new AuthenticationClient({
|
||
|
domain: '{YOUR_ACCOUNT}.auth0.com',
|
||
|
clientId: '{CLIENT_ID}',
|
||
|
clientSecret: '{CLIENT_SECRET}'
|
||
|
});
|
||
|
|
||
|
auth0.clientCredentialsGrant({
|
||
|
audience: 'https://{YOUR_ACCOUNT}.auth0.com/api/v2/',
|
||
|
scope: '{MANAGEMENT_API_SCOPES}'
|
||
|
}, function (err, response) {
|
||
|
if (err) {
|
||
|
// Handle error.
|
||
|
}
|
||
|
console.log(response.access_token);
|
||
|
});</code></pre><p>Also you can request a token when the user authenticates using any of our client side SDKs, e.g. <a href="https://github.com/auth0/auth0.js">auth0.js</a>.</p>
|
||
|
<h2>Promises and callbacks</h2><p>Be aware that all methods can be used with promises or callbacks. However, when a callback is provided no promise will be returned.</p>
|
||
|
<pre class="prettyprint source lang-js"><code>// Using callbacks.
|
||
|
management.getUsers(function (err, users) {
|
||
|
if (err) {
|
||
|
// handle error.
|
||
|
}
|
||
|
console.log(users);
|
||
|
});
|
||
|
|
||
|
// Using promises.
|
||
|
management
|
||
|
.getUsers()
|
||
|
.then(function (users) {
|
||
|
console.log(users);
|
||
|
})
|
||
|
.catch(function (err) {
|
||
|
// Handle error.
|
||
|
});</code></pre><h2>Documentation</h2><p>You can find this library documentation in this <a href="http://auth0.github.io/node-auth0/">page</a>.</p>
|
||
|
<p>For more information about <a href="http://auth0.com">auth0</a> check our <a href="http://docs.auth0.com/">documentation page</a>.</p>
|
||
|
<h2>What is Auth0?</h2><p>Auth0 helps you to:</p>
|
||
|
<ul>
|
||
|
<li>Add authentication with <a href="https://docs.auth0.com/identityproviders">multiple authentication sources</a>, either social like <strong>Google, Facebook, Microsoft Account, LinkedIn, GitHub, Twitter, Box, Salesforce, amont others</strong>, or enterprise identity systems like <strong>Windows Azure AD, Google Apps, Active Directory, ADFS or any SAML Identity Provider</strong>.</li>
|
||
|
<li>Add authentication through more traditional <strong><a href="https://docs.auth0.com/mysql-connection-tutorial">username/password databases</a></strong>.</li>
|
||
|
<li>Add support for <strong><a href="https://docs.auth0.com/link-accounts">linking different user accounts</a></strong> with the same user.</li>
|
||
|
<li>Support for generating signed <a href="https://docs.auth0.com/jwt">Json Web Tokens</a> to call your APIs and <strong>flow the user identity</strong> securely.</li>
|
||
|
<li>Analytics of how, when and where users are logging in.</li>
|
||
|
<li>Pull data from other sources and add it to the user profile, through <a href="https://docs.auth0.com/rules">JavaScript rules</a>.</li>
|
||
|
</ul>
|
||
|
<h2>Create a free Auth0 Account</h2><ol>
|
||
|
<li>Go to <a href="https://auth0.com">Auth0</a> and click "Try Auth0 for Free".</li>
|
||
|
<li>Use Google, GitHub or Microsoft Account to login.</li>
|
||
|
</ol>
|
||
|
<h2>Issue Reporting</h2><p>If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The <a href="https://auth0.com/whitehat">Responsible Disclosure Program</a> details the procedure for disclosing security issues.</p>
|
||
|
<h2>Author</h2><p><a href="https://auth0.com">Auth0</a></p>
|
||
|
<h2>License</h2><p>This project is licensed under the MIT license. See the <a href="LICENSE">LICENSE</a> file for more info.</p>
|
||
|
<!-- Vaaaaarrrrsss --></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>
|