Skip to content

Commit 56fb287

Browse files
fix: Remove auth when cross origin redirect (box/box-codegen#648) (#488)
1 parent 2a24c7a commit 56fb287

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

.codegen.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "engineHash": "6f803a2", "specHash": "091b558", "version": "1.10.0" }
1+
{ "engineHash": "b5ed925", "specHash": "091b558", "version": "1.10.0" }

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/networking/boxNetworkClient.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,13 @@ export class BoxNetworkClient implements NetworkClient {
232232
message: `Unable to follow redirect for ${fetchOptions.url}`,
233233
});
234234
}
235+
const sameOrigin =
236+
new URL(fetchResponse.headers['location']).origin ===
237+
new URL(fetchOptions.url).origin;
235238
return this.fetch({
236239
...options,
240+
params: undefined,
241+
auth: sameOrigin ? fetchOptions.auth : undefined,
237242
url: fetchResponse.headers['location'],
238243
});
239244
}

0 commit comments

Comments
 (0)