client-oauth2
Advanced tools
Comparing version 4.3.2 to 4.3.3
{ | ||
"name": "client-oauth2", | ||
"version": "4.3.2", | ||
"version": "4.3.3", | ||
"description": "Straight-forward execution of OAuth 2.0 flows and authenticated API requests", | ||
@@ -52,3 +52,3 @@ "main": "src/client-oauth2.js", | ||
"is-travis": "^2.0.0", | ||
"karma": "^5.0.3", | ||
"karma": "^5.1.1", | ||
"karma-browserify": "^7.0.0", | ||
@@ -58,6 +58,6 @@ "karma-chai": "^0.1.0", | ||
"karma-cli": "^2.0.0", | ||
"karma-coverage": "^2.0.1", | ||
"karma-coverage": "^2.0.3", | ||
"karma-firefox-launcher": "^1.3.0", | ||
"karma-mocha": "^2.0.1", | ||
"mocha": "^7.1.0", | ||
"mocha": "^8.1.0", | ||
"object-assign": "^4.1.1", | ||
@@ -64,0 +64,0 @@ "standard": "^14.3.3", |
@@ -164,9 +164,15 @@ var Buffer = require('safe-buffer').Buffer | ||
return options.authorizationUri + '?' + Querystring.stringify(Object.assign({ | ||
const qs = { | ||
client_id: options.clientId, | ||
redirect_uri: options.redirectUri, | ||
scope: sanitizeScope(options.scopes), | ||
response_type: tokenType, | ||
state: options.state | ||
}, options.query)) | ||
} | ||
if (options.scopes !== undefined) { | ||
qs.scope = sanitizeScope(options.scopes) | ||
} | ||
const sep = options.authorizationUri.includes('?') ? '&' : '?' | ||
return options.authorizationUri + sep + Querystring.stringify( | ||
Object.assign(qs, options.query)) | ||
} | ||
@@ -419,2 +425,11 @@ | ||
const body = { | ||
username: username, | ||
password: password, | ||
grant_type: 'password' | ||
} | ||
if (options.scopes !== undefined) { | ||
body.scope = sanitizeScope(options.scopes) | ||
} | ||
return this.client._request(requestOptions({ | ||
@@ -426,8 +441,3 @@ url: options.accessTokenUri, | ||
}), | ||
body: { | ||
scope: sanitizeScope(options.scopes), | ||
username: username, | ||
password: password, | ||
grant_type: 'password' | ||
} | ||
body: body | ||
}, options)) | ||
@@ -534,2 +544,10 @@ .then(function (data) { | ||
const body = { | ||
grant_type: 'client_credentials' | ||
} | ||
if (options.scopes !== undefined) { | ||
body.scope = sanitizeScope(options.scopes) | ||
} | ||
return this.client._request(requestOptions({ | ||
@@ -541,6 +559,3 @@ url: options.accessTokenUri, | ||
}), | ||
body: { | ||
scope: sanitizeScope(options.scopes), | ||
grant_type: 'client_credentials' | ||
} | ||
body: body | ||
}, options)) | ||
@@ -677,2 +692,11 @@ .then(function (data) { | ||
const body = { | ||
grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer', | ||
assertion: token | ||
} | ||
if (options.scopes !== undefined) { | ||
body.scope = sanitizeScope(options.scopes) | ||
} | ||
return this.client._request(requestOptions({ | ||
@@ -682,7 +706,3 @@ url: options.accessTokenUri, | ||
headers: headers, | ||
body: { | ||
scope: sanitizeScope(options.scopes), | ||
grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer', | ||
assertion: token | ||
} | ||
body: body | ||
}, options)) | ||
@@ -689,0 +709,0 @@ .then(function (data) { |
33931
99940
760