@amaster.ai/runtime-cli 1.1.69 → 1.1.71

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/cli.js CHANGED
@@ -3208,10 +3208,12 @@ function createAmasterClient(appCode) {
3208
3208
  process.exit(1);
3209
3209
  }
3210
3210
  const token = getAccessToken(appCode);
3211
- if (token && shouldRefreshToken(appCode)) {
3211
+ const refreshManagedExternally = getAuthSession(appCode)?.refreshManagedExternally === true;
3212
+ if (token && !refreshManagedExternally && shouldRefreshToken(appCode)) {
3212
3213
  console.error(chalk4.yellow("\u26A0\uFE0F Session expiring soon. Please login again."));
3213
3214
  }
3214
3215
  const client = createClient({
3216
+ autoRefresh: !refreshManagedExternally,
3215
3217
  baseURL: appConfig.baseURL,
3216
3218
  headers: {
3217
3219
  "x-app-code": appCode,
@@ -3220,6 +3222,10 @@ function createAmasterClient(appCode) {
3220
3222
  } : {}
3221
3223
  },
3222
3224
  onUnauthorized: () => {
3225
+ if (refreshManagedExternally) {
3226
+ console.error(chalk4.red("Application authorization expired or was denied. Renew through the execution host and retry."));
3227
+ process.exit(1);
3228
+ }
3223
3229
  if (token) {
3224
3230
  console.error(chalk4.red("\n\u274C Session expired. Please login again."));
3225
3231
  console.error(chalk4.yellow(`Run: amaster login --app ${appCode}`));