Back to All

Extension > Getting Client ID and Environment on Running Application

(edited)

From Russell:

Sometimes, it's essential to know whether you're running in a Sandbox or the Live environment and to verify the Client ID of the instance you're running on. This can be done in the extension using the following:

ExtensionContext is part of the SettingsService (ISettingsService), which can be injected.

Once you've got the handle to SettingsService, do this:

string clientId = _settingsService.ExtensionContext().ClientId; // IE, "demo"
DirectScale.Disco.Extension.EnvironmentType envType = _settingsService.ExtensionContext().EnvironmentType;
 // EnvironmentType is an enum, and can be either Sandbox or Live

Read more: Verifying Extension Environment and Client ID