client-oauth2
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -268,2 +268,16 @@ (function (root) { | ||
/** | ||
* Sanitize the scopes option to be a string. | ||
* | ||
* @param {Array} scopes | ||
* @return {String} | ||
*/ | ||
function sanitizeScope (scopes) { | ||
if (!Array.isArray(scopes)) { | ||
return scopes == null ? null : String(scopes); | ||
} | ||
return scopes.join(' '); | ||
} | ||
/** | ||
* Construct an object that can handle the multiple OAuth 2.0 flows. | ||
@@ -589,3 +603,3 @@ * | ||
body: uriEncode({ | ||
scope: options.scope, | ||
scope: sanitizeScope(options.scopes), | ||
username: username, | ||
@@ -634,3 +648,3 @@ password: password, | ||
state: options.state, | ||
scope: options.scope, | ||
scope: sanitizeScope(options.scopes), | ||
client_id: options.clientId, | ||
@@ -741,3 +755,3 @@ redirect_uri: options.redirectUri, | ||
body: uriEncode({ | ||
scope: options.scope, | ||
scope: sanitizeScope(options.scopes), | ||
grant_type: 'client_credentials' | ||
@@ -783,3 +797,3 @@ }) | ||
state: options.state, | ||
scope: options.scope, | ||
scope: sanitizeScope(options.scopes), | ||
client_id: options.clientId, | ||
@@ -786,0 +800,0 @@ redirect_uri: options.redirectUri, |
{ | ||
"name": "client-oauth2", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "A no-dependency library for executing OAuth 2.0 flows.", | ||
@@ -5,0 +5,0 @@ "main": "client-oauth2.js", |
@@ -25,3 +25,3 @@ # Client OAuth 2.0 | ||
redirectUri: 'http://example.com/auth/github/callback', | ||
scope: 'notifications' | ||
scopes: ['notifications', 'gist'] | ||
}); | ||
@@ -28,0 +28,0 @@ ``` |
@@ -9,3 +9,3 @@ describe('code', function () { | ||
redirectUri: 'http://example.com/auth/callback', | ||
scope: 'notifications' | ||
scopes: ['notifications'] | ||
}); | ||
@@ -12,0 +12,0 @@ |
@@ -9,3 +9,3 @@ describe('credentials', function () { | ||
redirectUri: 'http://example.com/auth/callback', | ||
scope: 'notifications' | ||
scopes: ['notifications'] | ||
}); | ||
@@ -12,0 +12,0 @@ |
@@ -9,3 +9,3 @@ describe('token', function () { | ||
redirectUri: 'http://example.com/auth/callback', | ||
scope: 'notifications' | ||
scopes: 'notifications' | ||
}); | ||
@@ -12,0 +12,0 @@ |
@@ -9,3 +9,3 @@ describe('user token instance', function () { | ||
redirectUri: 'http://example.com/auth/callback', | ||
scope: 'notifications' | ||
scopes: ['notifications'] | ||
}); | ||
@@ -12,0 +12,0 @@ |
@@ -13,3 +13,3 @@ var nock = require('nock'); | ||
redirectUri: 'http://example.com/auth/callback', | ||
scope: 'notifications' | ||
scopes: 'notifications' | ||
}); | ||
@@ -16,0 +16,0 @@ |
@@ -13,3 +13,3 @@ var nock = require('nock'); | ||
redirectUri: 'http://example.com/auth/callback', | ||
scope: 'notifications' | ||
scopes: ['notifications'] | ||
}); | ||
@@ -16,0 +16,0 @@ |
@@ -12,3 +12,3 @@ var expect = require('chai').expect; | ||
redirectUri: 'http://example.com/auth/callback', | ||
scope: 'notifications' | ||
scopes: ['notifications'] | ||
}); | ||
@@ -15,0 +15,0 @@ |
@@ -13,3 +13,3 @@ var nock = require('nock'); | ||
redirectUri: 'http://example.com/auth/callback', | ||
scope: 'notifications' | ||
scopes: 'notifications' | ||
}); | ||
@@ -16,0 +16,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
55377
1450