Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

auth0

Package Overview
Dependencies
Maintainers
1
Versions
156
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

auth0 - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

lib/Client.js

54

lib/index.js

@@ -1,53 +0,1 @@

var request = require('request');
var api = require('./api');
function Client(options) {
['clientID', 'clientSecret'].forEach(function (k) {
if(!options[k]){
throw new Error(k + ' is required');
}
});
options.namespace = options.namespace || 'app.auth0.com';
this.apiUrl = 'https://' + options.namespace + '/api';
this.tokenUrl = 'https://' + options.namespace + '/oauth/token';
this.options = options;
}
Client.prototype._getAccessToken = function(done){
var body = {
'client_id': this.options.clientID,
'client_secret': this.options.clientSecret,
'grant_type': 'client_credentials'
};
request.post({
url: this.tokenUrl,
form: body
}, function (err, resp, body) {
if(err) return done(err);
if (resp.statusCode === 404) return done(new Error('unknown client'));
var accessToken = JSON.parse(body)['access_token'];
done(null, accessToken);
});
};
Object.keys(api).forEach(function (m) {
Client.prototype[m] = function (){
var args = [].slice.call(arguments),
callback = args[args.length - 1];
this._getAccessToken(function (err, accessToken) {
if (err) return callback(err);
api[m].apply(this, [accessToken].concat(args));
}.bind(this));
};
});
module.exports = Client;
module.exports = require('./Client');
{
"name": "auth0",
"version": "0.1.1",
"version": "0.1.2",
"description": "Client library for the Auth0 platform",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -14,3 +14,4 @@ Node.js client library for the Auth0 platform.

clientID: 'your-client-id',
clientSecret: 'your-client-secret'
clientSecret: 'your-client-secret',
domain: ''
});

@@ -17,0 +18,0 @@ ~~~

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc