From 2199d7845195e6241004aeb2c766f6e2196cd1d7 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 18 Jan 2017 16:24:30 -0500 Subject: [PATCH] ignore 'undefined' rather than stringify --- oauth3.core.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/oauth3.core.js b/oauth3.core.js index bee3d67..e44cc94 100644 --- a/oauth3.core.js +++ b/oauth3.core.js @@ -16,9 +16,15 @@ var qs = []; Object.keys(params).forEach(function (key) { + // TODO nullify instead? + if ('undefined' === typeof params[key]) { + return; + } + if ('scope' === key) { params[key] = core.stringifyscope(params[key]); } + qs.push(encodeURIComponent(key) + '=' + encodeURIComponent(params[key])); }); @@ -182,6 +188,10 @@ var clientId = opts.appId || opts.clientId; var args = directive.otp; + if (!directive.otp) { + console.log('[debug] loginCode directive:'); + console.log(directive); + } var params = { "username": opts.id || opts.username , "request_otp": true // opts.requestOtp || undefined