Skip to main content
Connect your Flows custom app to the Cognite Data Fusion (CDF) host window and get credentials for authenticated SDK access. Call connectToHostApp once at app startup. It returns a HostAppAPI instance with methods to get the current project, base URL, and access token. Use those credentials to construct a CogniteClient. For navigation, state, sidebar visibility, fullscreen, and agent integration, see Host App API.

Prerequisites

connectToHostApp

Connects your app to the CDF host window and returns a HostAppAPI instance.

Return value

Example: connect and get project

HostAppAPI credential methods

The HostAppAPI instance returned by connectToHostApp includes methods for the current project, base URL, and access token. For navigation, state, sidebar visibility, fullscreen, and agent integration, see Host App API.

getProject

Returns the current CDF project name.

getBaseUrl

Returns the base URL of the CDF cluster (for example, https://greenfield.cognitedata.com).

getAccessToken

Returns the current access token for authenticating CDF API calls.

Example: construct a CogniteClient

Use getProject, getBaseUrl, and getAccessToken together to build an authenticated CogniteClient from @cognite/sdk:

Further reading

Last modified on August 5, 2026