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.mjs
CHANGED
|
@@ -1466,7 +1466,8 @@ async function refreshAccessToken() {
|
|
|
1466
1466
|
const body = new URLSearchParams({
|
|
1467
1467
|
grant_type: DEFAULT_REFRESH_GRANT_TYPE,
|
|
1468
1468
|
refresh_token: refreshToken,
|
|
1469
|
-
client_id: clientId.startsWith("public-") ? clientId : `public-${clientId}
|
|
1469
|
+
client_id: clientId.startsWith("public-") ? clientId : `public-${clientId}`,
|
|
1470
|
+
tenant_id: tenantId
|
|
1470
1471
|
});
|
|
1471
1472
|
const response = await fetch(tokenUrl, {
|
|
1472
1473
|
method: "POST",
|
|
@@ -2655,17 +2656,19 @@ async function resolveTenant(tenantKey) {
|
|
|
2655
2656
|
}
|
|
2656
2657
|
if (!data || typeof data !== "object") return null;
|
|
2657
2658
|
const res = data;
|
|
2658
|
-
if (!res.
|
|
2659
|
+
if (!res.success || !res.data) return null;
|
|
2660
|
+
const tenant = res.data;
|
|
2661
|
+
if (!tenant.id || !tenant.clientCode) return null;
|
|
2659
2662
|
const authServer = Config.getAuthServerUrl();
|
|
2660
2663
|
const redirectUri = Config.getRedirectUri();
|
|
2661
2664
|
if (!authServer || !redirectUri) return null;
|
|
2662
|
-
const clientCodeWithPrefix =
|
|
2665
|
+
const clientCodeWithPrefix = tenant.clientCode.startsWith(PUBLIC_CODE_PREFIX) ? tenant.clientCode : `${PUBLIC_CODE_PREFIX}${tenant.clientCode}`;
|
|
2663
2666
|
const config = {
|
|
2664
|
-
tenantId:
|
|
2667
|
+
tenantId: tenant.id,
|
|
2665
2668
|
authServer,
|
|
2666
2669
|
tenantKey: tenantCode,
|
|
2667
2670
|
client: {
|
|
2668
|
-
clientId:
|
|
2671
|
+
clientId: tenant.clientCode,
|
|
2669
2672
|
clientCode: clientCodeWithPrefix,
|
|
2670
2673
|
redirectUri,
|
|
2671
2674
|
scopes: DEFAULT_SCOPES2
|