@openfin/cloud-interop
This package contains an override that enables Cloud Interop for InteropBroker
's unlocking Interop across applications and devices. It is powered by the @openfin/cloud-interop-core-api package which provides an API client to communicate with the Cloud Interop Service.
Overrides are passed to fin.Platform.init
when initializing a platform or to fin.Interop.init
when creating an InteropBroker
directly.
Once overriden the InteropBroker
will connect to the given Cloud Interop Service upon initialization. Context
will be sent to the Cloud Interop server and the broker will receive Context
updates from other any other connected brokers in the shared session.
Usage
In a Platform with other overrides:
import { cloudInteropOverride } from "@openfin/cloud-interop";
import { ExampleOverride } from "./example";
const cloudConfig = {
url: "<CLOUD_INTEROP_SERVICE_URL>",
platformId: "my-platform",
sourceId: "my-desktop"
};
const InitializedCloudInteropOverride = await cloudInteropOverride(cloudConfig);
await fin.Platform.init({
interopOverride: [ExampleOverride, InitializedCloudInteropOverride],
});
When creating an InteropBroker
directly:
import { cloudInteropOverride } from "@openfin/cloud-interop";
const cloudConfig = {
url: "<CLOUD_INTEROP_SERVICE_URL>",
platformId: "my-platform",
sourceId: "my-desktop"
};
const InitializedCloudInteropOverride = await cloudInteropOverride(cloudConfig);
await fin.Interop.init(fin.me.uuid, InitializedCloudInteropOverride);
Authentication
The Cloud Interop API client offers various authentication methods which can be enabled through configuration.
Interactive session based authentication using cookies (default):
import { cloudInteropOverride } from "@openfin/cloud-interop";
const cloudConfig = {
url: "<CLOUD_INTEROP_SERVICE_URL>",
platformId: "my-platform",
sourceId: "my-desktop",
};
const InitializedCloudInteropOverride = await cloudInteropOverride(cloudConfig);
Basic authentication with credentials provisioned per Cloud Interop Service:
import { cloudInteropOverride } from "@openfin/cloud-interop";
const cloudConfig = {
url: "<CLOUD_INTEROP_SERVICE_URL>",
platformId: "my-platform",
sourceId: "my-desktop",
authenticationType: "basic",
basicAuthenticationParameters: {
username: "bob@acme.com",
password: "password"
}
};
const InitializedCloudInteropOverride = await cloudInteropOverride(cloudConfig);
JWT token authentication:
import { cloudInteropOverride } from "@openfin/cloud-interop";
const cloudConfig = {
url: "<CLOUD_INTEROP_SERVICE_URL>",
platformId: "my-platform",
sourceId: "my-desktop",
authenticationType: "jwt",
jwtAuthenticationParameters: {
authenticationId: "00b671f2-e1a9-4c29-9fa9-55f1988a11fb",
jwtRequestCallback: () => "my-token"
}
};
const InitializedCloudInteropOverride = await cloudInteropOverride(cloudConfig);