mage-remote-run 0.26.0 → 0.26.1
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/lib/api/saas.js +5 -0
- package/lib/commands/connections.js +21 -6
- package/package.json +1 -1
package/lib/api/saas.js
CHANGED
|
@@ -38,6 +38,11 @@ export class SaasClient extends ApiClient {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
async getToken() {
|
|
41
|
+
// Support static token from config
|
|
42
|
+
if (this.config.auth.token) {
|
|
43
|
+
return this.config.auth.token;
|
|
44
|
+
}
|
|
45
|
+
|
|
41
46
|
if (this.token && Date.now() < this.tokenExpiresAt) {
|
|
42
47
|
return this.token;
|
|
43
48
|
}
|
|
@@ -378,6 +378,15 @@ Examples:
|
|
|
378
378
|
SaaS (Non-Interactive):
|
|
379
379
|
$ mage-remote-run connection add --name "MySaaS" --type ac-saas --url "https://example.com" --client-id "id" --client-secret "secret" --active
|
|
380
380
|
|
|
381
|
+
SaaS (Pre-generated Token):
|
|
382
|
+
$ mage-remote-run connection add --name "MySaaS" --type ac-saas --url "https://example.com" --token "access_token_here"
|
|
383
|
+
|
|
384
|
+
PaaS (Integration Token):
|
|
385
|
+
$ mage-remote-run connection add --name "MyPaaS" --type ac-cloud-paas --url "https://paas.example.com" --token "integration_token"
|
|
386
|
+
|
|
387
|
+
OAuth 1.0a (Non-Interactive):
|
|
388
|
+
$ mage-remote-run connection add --name "MyOAuth" --type ac-on-prem --url "https://example.com" --consumer-key "ck" --consumer-secret "cs" --access-token "at" --token-secret "ts"
|
|
389
|
+
|
|
381
390
|
Bearer Token (Non-Interactive):
|
|
382
391
|
$ mage-remote-run connection add --name "MyStore" --type magento-os --url "https://magento.example.com" --token "tkn"
|
|
383
392
|
`)
|
|
@@ -403,13 +412,19 @@ Examples:
|
|
|
403
412
|
};
|
|
404
413
|
|
|
405
414
|
if (options.type === 'ac-saas') {
|
|
406
|
-
if (
|
|
407
|
-
|
|
415
|
+
if (options.token) {
|
|
416
|
+
settings.auth = { token: options.token };
|
|
417
|
+
// Optional: still save client ID/secret if provided, but token takes precedence
|
|
418
|
+
if (options.clientId) settings.auth.clientId = options.clientId;
|
|
419
|
+
if (options.clientSecret) settings.auth.clientSecret = options.clientSecret;
|
|
420
|
+
} else if (!options.clientId || !options.clientSecret) {
|
|
421
|
+
throw new Error('SaaS authentication requires --client-id and --client-secret (or --token)');
|
|
422
|
+
} else {
|
|
423
|
+
settings.auth = {
|
|
424
|
+
clientId: options.clientId,
|
|
425
|
+
clientSecret: options.clientSecret
|
|
426
|
+
};
|
|
408
427
|
}
|
|
409
|
-
settings.auth = {
|
|
410
|
-
clientId: options.clientId,
|
|
411
|
-
clientSecret: options.clientSecret
|
|
412
|
-
};
|
|
413
428
|
} else {
|
|
414
429
|
// Infer auth method if not provided
|
|
415
430
|
let method = options.authMethod;
|