fetch-mw-oauth2
Advanced tools
Comparing version 0.3.1 to 0.3.3
Changelog | ||
========= | ||
0.3.3 (2019-03-18) | ||
------------------ | ||
* When refreshing a token, browsers don't allow re-use of the same `Request` | ||
object. Now we're cloning it before use. | ||
0.3.2 (2019-03-13) | ||
------------------ | ||
* When refreshing a token, and there's no `client_secret`, the `client_id` | ||
must be sent in the body. | ||
0.3.1 (2019-03-13) | ||
@@ -5,0 +19,0 @@ ------------------ |
@@ -28,3 +28,3 @@ "use strict"; | ||
let accessToken = await this.getAccessToken(); | ||
let response = await requestWithBearerToken(request, accessToken); | ||
let response = await requestWithBearerToken(request.clone(), accessToken); | ||
if (!response.ok && response.status === 401) { | ||
@@ -35,3 +35,3 @@ accessToken = await this.refreshToken(); | ||
} | ||
return fetch(request); | ||
return response; | ||
} | ||
@@ -63,2 +63,7 @@ /** | ||
}; | ||
if (!this.options.clientSecret) { | ||
// If there is no secret, it means we need to send the clientId along | ||
// in the body. | ||
body.client_id = this.options.clientId; | ||
} | ||
} | ||
@@ -65,0 +70,0 @@ else { |
@@ -72,2 +72,3 @@ /** | ||
scope?: string; | ||
client_id?: string; | ||
} | { | ||
@@ -74,0 +75,0 @@ grant_type: 'authorization_code'; |
{ | ||
"name": "fetch-mw-oauth2", | ||
"version": "0.3.1", | ||
"version": "0.3.3", | ||
"description": "Fetch middleware to add OAuth2 support", | ||
@@ -24,6 +24,6 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@types/node": "^11.11.1", | ||
"@types/node": "^11.11.3", | ||
"awesome-typescript-loader": "^5.2.1", | ||
"node-fetch": "^2.3.0", | ||
"tslint": "^5.13.1", | ||
"tslint": "^5.14.0", | ||
"typescript": "^3.3.3333", | ||
@@ -30,0 +30,0 @@ "webpack": "^4.29.6", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
3
36948
311