tenneo-auth-plugin 0.1.2 → 0.1.4
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.
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2655,17 +2655,19 @@ async function resolveTenant(tenantKey) {
|
|
|
2655
2655
|
}
|
|
2656
2656
|
if (!data || typeof data !== "object") return null;
|
|
2657
2657
|
const res = data;
|
|
2658
|
-
if (!res.
|
|
2658
|
+
if (!res.success || !res.data) return null;
|
|
2659
|
+
const tenant = res.data;
|
|
2660
|
+
if (!tenant.id || !tenant.clientCode) return null;
|
|
2659
2661
|
const authServer = Config.getAuthServerUrl();
|
|
2660
2662
|
const redirectUri = Config.getRedirectUri();
|
|
2661
2663
|
if (!authServer || !redirectUri) return null;
|
|
2662
|
-
const clientCodeWithPrefix =
|
|
2664
|
+
const clientCodeWithPrefix = tenant.clientCode.startsWith(PUBLIC_CODE_PREFIX) ? tenant.clientCode : `${PUBLIC_CODE_PREFIX}${tenant.clientCode}`;
|
|
2663
2665
|
const config = {
|
|
2664
|
-
tenantId:
|
|
2666
|
+
tenantId: tenant.id,
|
|
2665
2667
|
authServer,
|
|
2666
2668
|
tenantKey: tenantCode,
|
|
2667
2669
|
client: {
|
|
2668
|
-
clientId:
|
|
2670
|
+
clientId: tenant.clientCode,
|
|
2669
2671
|
clientCode: clientCodeWithPrefix,
|
|
2670
2672
|
redirectUri,
|
|
2671
2673
|
scopes: DEFAULT_SCOPES2
|