TsgcWSAPIKeyManager › Methods › GrantScope
Adds a scope to an existing key.
procedure GrantScope(const aKey, aScope: string);
| Name | Type | Description |
|---|---|---|
aKey | const string | Raw plaintext key whose scope list will be extended. |
aScope | const string | Case-sensitive scope identifier to add (for example write:shipments). Must already exist in the Scopes catalog when Scopes.Enabled is True. |
Attaches an additional scope to an issued key without re-issuing it — the customer keeps the same key string but can now hit endpoints that require the new scope. No-op when the scope is already present. Appends a kaaScopeGranted audit entry (with the scope name in Details when Audit.IncludePayload is True) and persists the change when StorageType is kstFile. Use it to upgrade a customer's plan in-flight.
// Upgrade: customer also needs to create shipments now
sgcWSAPIKeyManager1.GrantScope(vKey, 'write:shipments');