From 33d66b8318a81ba3a1f9d9596dafaff819d1e79e Mon Sep 17 00:00:00 2001 From: jcenturion Date: Tue, 19 Apr 2016 14:22:52 -0300 Subject: [PATCH] Adding node polyfills for web bundle --- package.json | 2 +- src/auth/index.js | 2 +- src/management/index.js | 4 ++-- webpack.config.js | 8 ++++++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 5af394ad1..88c54c3f9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "auth0", - "version": "2.1.0", + "version": "2.2.0", "description": "SDK for Auth0 API v2", "main": "src/index.js", "scripts": { diff --git a/src/auth/index.js b/src/auth/index.js index 002f07b50..31b227b43 100644 --- a/src/auth/index.js +++ b/src/auth/index.js @@ -66,7 +66,7 @@ var AuthenticationClient = function (options) { }; if (options.telemetry !== false) { - var telemetry = jsonToBase64(this.getClientInfo()); + var telemetry = jsonToBase64(options.clientInfo || this.getClientInfo()); managerOptions.headers['Auth0-Client'] = telemetry; } diff --git a/src/management/index.js b/src/management/index.js index b9b02caf9..bd7ee030a 100644 --- a/src/management/index.js +++ b/src/management/index.js @@ -73,7 +73,8 @@ var ManagementClient = function (options) { }; if (options.telemetry !== false) { - var telemetry = jsonToBase64(this.getClientInfo()); + var telemetry = jsonToBase64(options.clientInfo || this.getClientInfo()); + managerOptions.headers['Auth0-Client'] = telemetry; } @@ -188,7 +189,6 @@ ManagementClient.prototype.getClientInfo = function () { version: process.version.replace('v', '') }] }; - // Add the dependencies to the client info object. Object .keys(pkg.dependencies) diff --git a/webpack.config.js b/webpack.config.js index bf8e553f3..889c6f6fe 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -11,6 +11,11 @@ module.exports = { library: 'Auth0', libraryTarget: 'umd', }, + node: { + Buffer: true, + process: true, + url: true + }, module: { loaders: [ { @@ -46,6 +51,5 @@ module.exports = { modulesDirectories: ['node_modules'], root: __dirname, alias: {}, - }, - node: false + } };