Skip to content

Function: useServicePrincipal()

useServicePrincipal(mode, req?): boolean

Whether req should run its Databricks calls as the app service principal rather than OBO.

  • "service-principal" -> always true.
  • "user" -> always false, even with no token. The mode is an explicit assertion that every caller is OBO-capable, so a missing token is a real error and must surface as AppKit’s AuthenticationError rather than being quietly downgraded to shared data access.
  • "auto" -> true only when the request carries no usable OBO token.

A request AppKit will not accept for OBO anyway (no token) can never be served by entering asUser, so in "auto" mode the token check is the whole decision: it is the same condition AppKit itself branches on, just resolved before it can throw.

IdentityMode

HeaderBearing

boolean