fix: enhance authorization token capture logic based on checkout feature status
This commit is contained in:
parent
308f77f84e
commit
695182c44f
2 changed files with 19 additions and 12 deletions
|
|
@ -17,16 +17,21 @@
|
|||
var listenerPatchActive = true;
|
||||
var dragHandlerInstalled = false;
|
||||
|
||||
// Capture Authorization token from XHR requests
|
||||
// Capture Authorization token from XHR requests (only if checkout is enabled)
|
||||
window.capturedAuthToken = null;
|
||||
var originalXHRSetRequestHeader = XMLHttpRequest.prototype.setRequestHeader;
|
||||
XMLHttpRequest.prototype.setRequestHeader = function(header, value) {
|
||||
if (header === 'Authorization' && value.startsWith('Bearer ')) {
|
||||
window.capturedAuthToken = value;
|
||||
console.log('[Intercept] Captured auth token');
|
||||
}
|
||||
return originalXHRSetRequestHeader.apply(this, arguments);
|
||||
};
|
||||
if (window.webdropConfig && window.webdropConfig.enableCheckout) {
|
||||
console.log('[Intercept] Auth token capture enabled (checkout feature active)');
|
||||
var originalXHRSetRequestHeader = XMLHttpRequest.prototype.setRequestHeader;
|
||||
XMLHttpRequest.prototype.setRequestHeader = function(header, value) {
|
||||
if (header === 'Authorization' && value.startsWith('Bearer ')) {
|
||||
window.capturedAuthToken = value;
|
||||
console.log('[Intercept] Captured auth token');
|
||||
}
|
||||
return originalXHRSetRequestHeader.apply(this, arguments);
|
||||
};
|
||||
} else {
|
||||
console.log('[Intercept] Auth token capture disabled (checkout feature inactive)');
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// PART 1: Intercept Angular's dragstart listener registration
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue