tenneo-auth-plugin 0.1.1 → 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.js
CHANGED
|
@@ -2662,17 +2662,19 @@ async function resolveTenant(tenantKey) {
|
|
|
2662
2662
|
}
|
|
2663
2663
|
if (!data || typeof data !== "object") return null;
|
|
2664
2664
|
const res = data;
|
|
2665
|
-
if (!res.
|
|
2665
|
+
if (!res.success || !res.data) return null;
|
|
2666
|
+
const tenant = res.data;
|
|
2667
|
+
if (!tenant.id || !tenant.clientCode) return null;
|
|
2666
2668
|
const authServer = Config.getAuthServerUrl();
|
|
2667
2669
|
const redirectUri = Config.getRedirectUri();
|
|
2668
2670
|
if (!authServer || !redirectUri) return null;
|
|
2669
|
-
const clientCodeWithPrefix =
|
|
2671
|
+
const clientCodeWithPrefix = tenant.clientCode.startsWith(PUBLIC_CODE_PREFIX) ? tenant.clientCode : `${PUBLIC_CODE_PREFIX}${tenant.clientCode}`;
|
|
2670
2672
|
const config = {
|
|
2671
|
-
tenantId:
|
|
2673
|
+
tenantId: tenant.id,
|
|
2672
2674
|
authServer,
|
|
2673
2675
|
tenantKey: tenantCode,
|
|
2674
2676
|
client: {
|
|
2675
|
-
clientId:
|
|
2677
|
+
clientId: tenant.clientCode,
|
|
2676
2678
|
clientCode: clientCodeWithPrefix,
|
|
2677
2679
|
redirectUri,
|
|
2678
2680
|
scopes: DEFAULT_SCOPES2
|