/auth0-api-tokens

Library that given Auth0 global client credentials allows users to generate JWT tokens for API v2

Primary LanguageJavaScriptMIT LicenseMIT

auth0-api-tokens build status

Library that given Auth0 global client credentials allows users to generate JWT tokens for API v2.

You can read more about API v2 tokens in this blog post and in the API explorer.

Installation

npm i auth0-api-tokens

Usage

var TOKEN_EXPIRATION_IN_SECONDS = 3600;

var createToken = require('auth0-api-tokens')({
    clientId: '{YOUR_GLOBAL_CLIENT_ID}',
    clientSecret: '{YOUR_GLOBAL_CLIENT_Secret}',
}, TOKEN_EXPIRATION_IN_SECONDS)

// each key is an entity, each array element is an action
var token = createToken({
    users: ['read', 'write'],
    clients: ['delete']
});

console.log(token); // 'ey...'

Documentation

For more information about auth0 contact our documentation page.

Issue Reporting

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 Responsible Disclosure Program details the procedure for disclosing security issues.

Author

Auth0

License

This project is licensed under the MIT license. See the LICENSE file for more info.