@friggframework/core 2.0.0-next.65 → 2.0.0-next.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -239,11 +239,14 @@ class OAuth2Requester extends Requester {
|
|
|
239
239
|
|
|
240
240
|
/**
|
|
241
241
|
* Adds OAuth Bearer token to request headers.
|
|
242
|
+
* Clears any existing Authorization header first to prevent stale tokens
|
|
243
|
+
* from being reused after failed refresh attempts.
|
|
242
244
|
*
|
|
243
245
|
* @param {Object} headers - Headers object to modify
|
|
244
246
|
* @returns {Promise<Object>} Headers with Authorization added
|
|
245
247
|
*/
|
|
246
248
|
async addAuthHeaders(headers) {
|
|
249
|
+
delete headers.Authorization;
|
|
247
250
|
if (this.access_token) {
|
|
248
251
|
headers.Authorization = `Bearer ${this.access_token}`;
|
|
249
252
|
}
|
|
@@ -272,7 +275,7 @@ class OAuth2Requester extends Requester {
|
|
|
272
275
|
*
|
|
273
276
|
* On failure, notifies delegates via DLGT_INVALID_AUTH.
|
|
274
277
|
*
|
|
275
|
-
* @returns {Promise<
|
|
278
|
+
* @returns {Promise<boolean>} True if refresh succeeded, false if failed
|
|
276
279
|
*/
|
|
277
280
|
async refreshAuth() {
|
|
278
281
|
try {
|
|
@@ -283,8 +286,10 @@ class OAuth2Requester extends Requester {
|
|
|
283
286
|
} else {
|
|
284
287
|
await this.getTokenFromClientCredentials();
|
|
285
288
|
}
|
|
289
|
+
return true;
|
|
286
290
|
} catch {
|
|
287
291
|
await this.notify(this.DLGT_INVALID_AUTH);
|
|
292
|
+
return false;
|
|
288
293
|
}
|
|
289
294
|
}
|
|
290
295
|
|
|
@@ -75,8 +75,10 @@ class Requester extends Delegate {
|
|
|
75
75
|
await this.notify(this.DLGT_INVALID_AUTH);
|
|
76
76
|
} else {
|
|
77
77
|
this.refreshCount++;
|
|
78
|
-
await this.refreshAuth();
|
|
79
|
-
|
|
78
|
+
const refreshSucceeded = await this.refreshAuth();
|
|
79
|
+
if (refreshSucceeded) {
|
|
80
|
+
return this._request(url, options, i + 1);
|
|
81
|
+
}
|
|
80
82
|
}
|
|
81
83
|
}
|
|
82
84
|
|
|
@@ -108,7 +110,6 @@ class Requester extends Delegate {
|
|
|
108
110
|
}
|
|
109
111
|
|
|
110
112
|
async _post(options, stringify = true) {
|
|
111
|
-
console.log('options', options);
|
|
112
113
|
const fetchOptions = {
|
|
113
114
|
method: 'POST',
|
|
114
115
|
credentials: 'include',
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@friggframework/core",
|
|
3
3
|
"prettier": "@friggframework/prettier-config",
|
|
4
|
-
"version": "2.0.0-next.
|
|
4
|
+
"version": "2.0.0-next.67",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@aws-sdk/client-apigatewaymanagementapi": "^3.588.0",
|
|
7
7
|
"@aws-sdk/client-kms": "^3.588.0",
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@friggframework/eslint-config": "2.0.0-next.
|
|
42
|
-
"@friggframework/prettier-config": "2.0.0-next.
|
|
43
|
-
"@friggframework/test": "2.0.0-next.
|
|
41
|
+
"@friggframework/eslint-config": "2.0.0-next.67",
|
|
42
|
+
"@friggframework/prettier-config": "2.0.0-next.67",
|
|
43
|
+
"@friggframework/test": "2.0.0-next.67",
|
|
44
44
|
"@prisma/client": "^6.17.0",
|
|
45
45
|
"@types/lodash": "4.17.15",
|
|
46
46
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"publishConfig": {
|
|
81
81
|
"access": "public"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "6b324d858e2593833a79f66c00b700272013a8cf"
|
|
84
84
|
}
|