We're working with a Geodatabase instance that comes from a feature service (Connector is ServiceConnectionProperties, URL is like 'https://localhost/server/rest/services/MyService/FeatureServer '). There's also a map server available to our URL that exposes a Server Object Extension that we want to call in the same context as the geodatabase (like ''https://localhost/server/rest/services/MyService/MapServer/exts/MySoe/MyRestApi'). But since this is an HTTPS Uri all calls to REST endpoints need to have a token.
Can somebody tell me how to retrieve the token that is currently used with the (Service) Geodatabase so that I can use it for my further calls to the SOE? Though I can retrieve a Token from the active portal I'm currently connected using
var arcGisPortalManager = ArcGISPortalManager.Current;
var arcGisPortal = arcGisPortalManager.GetActivePortal();
var token = arcGisPortal?.GetToken();
but that's not neccessary the token that is used by this Feature Service.
So in short: How can I retrieve the token from the Geodatabase?
Many thanks in advance!