client-oauth2
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -16,2 +16,12 @@ /* global define */ | ||
/** | ||
* Default headers for executing OAuth 2.0 flows. | ||
* | ||
* @type {Object} | ||
*/ | ||
var DEFAULT_HEADERS = { | ||
'Accept': 'application/json, application/x-www-form-urlencoded', | ||
'Content-Type': 'application/x-www-form-urlencoded' | ||
} | ||
/** | ||
* Format error response types to regular strings for displaying to clients. | ||
@@ -348,3 +358,7 @@ * | ||
rejectUnauthorized: this.options.rejectUnauthorized | ||
}, options) | ||
}, options, { | ||
body: assign({}, this.options.body, options.body), | ||
query: assign({}, this.options.query, options.query), | ||
headers: assign({}, this.options.headers, options.headers) | ||
}) | ||
} | ||
@@ -454,7 +468,5 @@ | ||
method: 'POST', | ||
headers: { | ||
'Accept': 'application/json, application/x-www-form-urlencoded', | ||
'Content-Type': 'application/x-www-form-urlencoded', | ||
'Authorization': auth(options.clientId, options.clientSecret) | ||
}, | ||
headers: assign({ | ||
Authorization: auth(options.clientId, options.clientSecret) | ||
}, DEFAULT_HEADERS), | ||
body: { | ||
@@ -514,7 +526,5 @@ refresh_token: this.refreshToken, | ||
method: 'POST', | ||
headers: { | ||
'Accept': 'application/json, application/x-www-form-urlencoded', | ||
'Content-Type': 'application/x-www-form-urlencoded', | ||
'Authorization': auth(options.clientId, options.clientSecret) | ||
}, | ||
headers: assign({ | ||
Authorization: auth(options.clientId, options.clientSecret) | ||
}, DEFAULT_HEADERS), | ||
body: { | ||
@@ -645,7 +655,5 @@ scope: sanitizeScope(options.scopes), | ||
method: 'POST', | ||
headers: { | ||
'Accept': 'application/json, application/x-www-form-urlencoded', | ||
'Content-Type': 'application/x-www-form-urlencoded', | ||
'Authorization': auth(options.clientId, options.clientSecret) | ||
}, | ||
headers: assign({ | ||
Authorization: auth(options.clientId, options.clientSecret) | ||
}, DEFAULT_HEADERS), | ||
body: { | ||
@@ -735,6 +743,3 @@ scope: sanitizeScope(options.scopes), | ||
method: 'POST', | ||
headers: { | ||
'Accept': 'application/json, application/x-www-form-urlencoded', | ||
'Content-Type': 'application/x-www-form-urlencoded' | ||
}, | ||
headers: assign({}, DEFAULT_HEADERS), | ||
body: { | ||
@@ -781,8 +786,6 @@ code: data.code, | ||
var headers = { | ||
'Accept': 'application/json, application/x-www-form-urlencoded', | ||
'Content-Type': 'application/x-www-form-urlencoded' | ||
} | ||
var headers = assign({}, DEFAULT_HEADERS) | ||
// Authentication of the client is optional, as described in Section 3.2.1 of OAuth 2.0 [RFC6749] | ||
// Authentication of the client is optional, as described in | ||
// Section 3.2.1 of OAuth 2.0 [RFC6749] | ||
if (options.clientId) { | ||
@@ -789,0 +792,0 @@ headers['Authorization'] = auth(options.clientId, options.clientSecret) |
{ | ||
"name": "client-oauth2", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Straight-forward library for executing OAuth 2.0 flows and making API requests.", | ||
@@ -5,0 +5,0 @@ "main": "client-oauth2.js", |
@@ -40,4 +40,10 @@ # Client OAuth 2.0 | ||
**Request specific options (node)** | ||
**Request options** | ||
* **body** An object to merge with the body of every request | ||
* **query** An object to merge with the query parameters of every request | ||
* **headers** An object to merge with the headers of every request | ||
**Request options (node only)** | ||
* **rejectUnauthorized** Reject invalid SSL certificates (default: `true`) | ||
@@ -59,3 +65,3 @@ * **agent** Custom HTTP pooling agent (default: `infinity-agent`) | ||
.then(function (res) { | ||
console.log(res) //=> { raw: [Object], body: '...', status: 200, headers: { ... } } | ||
console.log(res) //=> { body: '...', status: 200, headers: { ... } } | ||
}) | ||
@@ -62,0 +68,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
30741
700
183