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 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.id || !res.clientCode) return null;
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 = res.clientCode.startsWith(PUBLIC_CODE_PREFIX) ? res.clientCode : `${PUBLIC_CODE_PREFIX}${res.clientCode}`;
2672
+ const clientCodeWithPrefix = tenant.clientCode.startsWith(PUBLIC_CODE_PREFIX) ? tenant.clientCode : `${PUBLIC_CODE_PREFIX}${tenant.clientCode}`;
2670
2673
  const config = {
2671
- tenantId: res.id,
2674
+ tenantId: tenant.id,
2672
2675
  authServer,
2673
2676
  tenantKey: tenantCode,
2674
2677
  client: {
2675
- clientId: res.clientCode,
2678
+ clientId: tenant.clientCode,
2676
2679
  clientCode: clientCodeWithPrefix,
2677
2680
  redirectUri,
2678
2681
  scopes: DEFAULT_SCOPES2