Fix jwt-token
This commit is contained in:
@@ -99,7 +99,6 @@ class MultiTenantAuth {
|
|||||||
if (hostParts.length >= 3) {
|
if (hostParts.length >= 3) {
|
||||||
const subdomain = hostParts[0];
|
const subdomain = hostParts[0];
|
||||||
if (subdomain && subdomain !== 'www' && subdomain !== 'api') {
|
if (subdomain && subdomain !== 'www' && subdomain !== 'api') {
|
||||||
console.log('🏢 Tenant from subdomain:', subdomain);
|
|
||||||
return subdomain;
|
return subdomain;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -107,11 +106,8 @@ class MultiTenantAuth {
|
|||||||
|
|
||||||
// Method 6: URL path (/tenant2/api/...)
|
// Method 6: URL path (/tenant2/api/...)
|
||||||
const urlPath = req.path || req.url || '';
|
const urlPath = req.path || req.url || '';
|
||||||
console.log('🏢 Raw urlPath value:', urlPath);
|
|
||||||
const pathSegments = urlPath.split('/').filter(segment => segment);
|
const pathSegments = urlPath.split('/').filter(segment => segment);
|
||||||
console.log('🏢 URL path segments:', pathSegments, 'from path:', req.path, 'or url:', req.url);
|
|
||||||
if (pathSegments.length > 0 && pathSegments[0] !== 'api') {
|
if (pathSegments.length > 0 && pathSegments[0] !== 'api') {
|
||||||
console.log('🏢 Tenant from URL path:', pathSegments[0]);
|
|
||||||
return pathSegments[0];
|
return pathSegments[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,11 +118,9 @@ class MultiTenantAuth {
|
|||||||
|
|
||||||
// Return null for localhost without tenant info
|
// Return null for localhost without tenant info
|
||||||
if (hostname && hostname.startsWith('localhost')) {
|
if (hostname && hostname.startsWith('localhost')) {
|
||||||
console.log('🏢 Localhost detected, returning null');
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('🏢 No tenant determined, returning null');
|
|
||||||
// Default to null
|
// Default to null
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user