tenneo-auth-plugin 0.1.2 → 0.1.5
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 +8 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1473,7 +1473,8 @@ async function refreshAccessToken() {
|
|
|
1473
1473
|
const body = new URLSearchParams({
|
|
1474
1474
|
grant_type: DEFAULT_REFRESH_GRANT_TYPE,
|
|
1475
1475
|
refresh_token: refreshToken,
|
|
1476
|
-
client_id: clientId.startsWith("public-") ? clientId : `public-${clientId}
|
|
1476
|
+
client_id: clientId.startsWith("public-") ? clientId : `public-${clientId}`,
|
|
1477
|
+
tenant_id: tenantId
|
|
1477
1478
|
});
|
|
1478
1479
|
const response = await fetch(tokenUrl, {
|
|
1479
1480
|
method: "POST",
|
|
@@ -2662,17 +2663,19 @@ async function resolveTenant(tenantKey) {
|
|
|
2662
2663
|
}
|
|
2663
2664
|
if (!data || typeof data !== "object") return null;
|
|
2664
2665
|
const res = data;
|
|
2665
|
-
if (!res.
|
|
2666
|
+
if (!res.success || !res.data) return null;
|
|
2667
|
+
const tenant = res.data;
|
|
2668
|
+
if (!tenant.id || !tenant.clientCode) return null;
|
|
2666
2669
|
const authServer = Config.getAuthServerUrl();
|
|
2667
2670
|
const redirectUri = Config.getRedirectUri();
|
|
2668
2671
|
if (!authServer || !redirectUri) return null;
|
|
2669
|
-
const clientCodeWithPrefix =
|
|
2672
|
+
const clientCodeWithPrefix = tenant.clientCode.startsWith(PUBLIC_CODE_PREFIX) ? tenant.clientCode : `${PUBLIC_CODE_PREFIX}${tenant.clientCode}`;
|
|
2670
2673
|
const config = {
|
|
2671
|
-
tenantId:
|
|
2674
|
+
tenantId: tenant.id,
|
|
2672
2675
|
authServer,
|
|
2673
2676
|
tenantKey: tenantCode,
|
|
2674
2677
|
client: {
|
|
2675
|
-
clientId:
|
|
2678
|
+
clientId: tenant.clientCode,
|
|
2676
2679
|
clientCode: clientCodeWithPrefix,
|
|
2677
2680
|
redirectUri,
|
|
2678
2681
|
scopes: DEFAULT_SCOPES2
|