Project (i.e. board) management provided by blockr.core via the preserve_board plugin is a simple file upload/download-based mechanism. More user-friendly alternatives using the pins package are available as manage_project plugin.

Installation

You can install the development version of blockr.session from GitHub with:

# install.packages("pak")
pak::pak("BristolMyersSquibb/blockr.session")

Example

We can start up an app that uses the manage_project() plugin by swapping out the default preserve_board() plugin.

The default storage backend is [pins::board_local()] which can be configured by setting the session_mgmt_backend [blockr_option()].

Using a Connect backend

To use Posit Connect as the storage backend, pass pins::board_connect (the function itself, not its result) as the backend option. This enables sharing, visibility controls, and per-user pin storage:

library(blockr.core)
library(blockr.dock)
library(blockr.session)

options(blockr.session_mgmt_backend = pins::board_connect)

serve(
  new_dock_board(),
  plugins = custom_plugins(manage_project())
)

get_session_backend() calls the function once per session, picking up credentials at runtime. The navbar dropdown gains a Sharing tab (next to Workflows and History) that lets you set visibility and share with other Connect users.

Deploying to Posit Connect

When deploying to Connect, the above is all that is needed — board_connect picks up the server URL and API key from the environment automatically.

Per-user pins with the Connect API Integration

By default, pins are stored under the deploying user’s namespace. To have each viewer’s pins saved under their own account, enable the Connect API Integration for the content:

  1. In Connect, open the content’s Settings → Access tab.
  2. Under API Integrations, enable the Posit Connect integration.
  3. Set the maximum role to Viewer (sufficient for reading and writing pins).

With the integration enabled, Connect injects an ephemeral CONNECT_API_KEY into each user’s session. Because pins::board_connect is called fresh per session, it automatically picks up that key via its default auth = "auto". No additional packages or configuration are needed — in particular, the connectcreds package is not required here; that package is for exchanging session credentials for third-party OAuth tokens (e.g. GitHub, Salesforce), which is a separate use case.