Available Credentials

Enhanced Advanced

The Available Credentials view

The Available Credentials view is part of the Posit Workbench extension sidebar. It displays your Databricks, Snowflake, and custom OAuth integrations, grouped under a heading for each type, and lets you manage authentication directly from the IDE. Groups with no configured integrations are hidden.

To open the view, click the Posit Workbench Extension tab in the Activity Bar.

Available Credentials view in the Posit Workbench sidebar, grouped by Databricks, Snowflake, and Custom OAuth

The Available Credentials view groups Databricks, Snowflake, and custom OAuth integrations, showing each one’s authentication status.

Each integration in the tree shows its current authentication status:

Status Icon Description
Authenticated Custom OAuth: you have signed in to this integration and it is ready to use. The description shows the Integration ID. Databricks and Snowflake: you have signed in, but must still activate the credential before your code can use it.
Active Databricks or Snowflake only: the credential is active in this session. Workbench has set its environment variables and written its configuration files.
Not signed in The integration requires authentication before use.
Configuration error The integration has a configuration problem. Point to the integration to see error details in the tooltip.
Note

The Available Credentials view automatically refreshes every 30 seconds when visible, and pauses when you hide the view to reduce resource usage. To manually refresh, click the Refresh button in the view toolbar.

Signing in

  1. In the Available Credentials view, locate the integration you want to authenticate with.
  2. Point to it and click the Sign In button that appears.

Sign In button on an unauthenticated credential

Click Sign In next to an unauthenticated integration to begin the OAuth flow.

A browser window opens to complete the OAuth authorization flow with the provider. After successful authentication, the integration status updates to show the key icon.

Activating Databricks and Snowflake credentials

To make a Databricks or Snowflake credential available to your code, activate it in the current session.

  1. In the Available Credentials view, locate the Databricks workspace or Snowflake role you want to use.
  2. Point to it and click the Activate in Session button that appears. If you have not signed in yet, this starts the sign-in flow first, then activates the credential once authentication succeeds.

Activate in Session button on a signed-in credential

Point to a signed-in Databricks or Snowflake credential to reveal the Activate in Session button.

New terminals and interpreters started after activation automatically pick up the credential.

Reloading after activating or deactivating

After you activate or deactivate a credential, Workbench prompts you to reload the window so other extensions see the change. If Positron interpreters are already running, it instead offers to reload and restart them. A reload alone reconnects to running interpreters without giving them the new credential, while restarting clears their variables and any loaded data. Terminals and interpreters started after the change do not need a reload.

Notification prompting to reload the window after activating a credential

Workbench prompts you to reload the window after a credential is activated or deactivated.

Snowflake roles

Expand a Snowflake account to see its individual roles, each with its own authentication and activation status:

Expanded Snowflake account showing one Active role and several Not signed in roles

An expanded Snowflake account shows one active role (green check) and several roles that still need authentication (lock icon).

To switch roles, click Activate in Session on a different role under the same account. The previously active role is deactivated automatically. You can also right-click a signed-in role and select Switch to This Role to do the same thing.

You can also:

  • Refresh Snowflake Roles: point to the account and click the refresh button that appears to request an updated role list, if your administrator has enabled this.
  • Add Snowflake Role: click Add role… below an account’s roles to add one that was not discovered automatically.
Note

If a Databricks workspace or Snowflake role was already selected for this session at launch in the New Session dialog, you can switch to a different workspace or role from this view, but you cannot deactivate it entirely. To turn it off, start a new session without selecting it. Point to the active credential to see this explained in its tooltip.

Deactivating a credential

  1. In the Available Credentials view, locate the active Databricks workspace or Snowflake role.
  2. Point to it and click the Deactivate button that appears.

Deactivate button on an active credential

Point to an active credential to reveal the Deactivate button.

Deactivating clears the credential’s environment variables and configuration files for this session, but leaves you signed in.

Signing out

  1. Right-click an authenticated integration.
  2. Select Sign Out.

Sign Out option in the context menu

Right-click an authenticated integration and select Sign Out.

The integration status updates to show the lock icon, indicating you are no longer signed in. A Databricks or Snowflake credential that was selected at session launch cannot be signed out or deactivated in-session, since its environment variables come from the session process itself. Start a new session without selecting it to turn it off.

Viewing integration details

This section applies to custom OAuth integrations. Databricks and Snowflake credentials are used directly through environment variables, so they do not expand to show configuration details.

Expand any integration in the tree to view its configuration details:

Expanded integration showing details like Integration ID, Issuer, Client ID, Scopes, and URLs

Expand an integration to view its details directly in the tree.

The view shows the following details:

  • Integration ID (Globally Unique Identifier (GUID)): the unique identifier needed for programmatic access
  • Issuer: the OAuth provider URL
  • Client ID: the OAuth client identifier
  • Scopes: the permissions granted to this integration
  • Auth URL: the OAuth authorization endpoint
  • Token URL: the OAuth token endpoint

To copy any detail value, point to it and click the Copy Value icon that appears on the right.

Generating code snippets

This section applies to custom OAuth integrations. Databricks and Snowflake credentials do not have code snippets to generate, since tools authenticate with them automatically once activated.

The Available Credentials view can generate ready-to-use Python or R code for retrieving OAuth credentials. This is a quick way to get started with the posit-sdk (Python) or rstudioapi (R) packages.

Copying a snippet

  1. Right-click an authenticated integration.
  2. Select Copy Python Snippet or Copy R Snippet.

The snippet is copied to your clipboard, ready to paste into your editor.

Viewing a snippet

  1. Right-click an authenticated integration.
  2. Select View Python Snippet or View R Snippet.

A read-only editor tab opens with the generated code, with syntax highlighting. From there you can review the code before copying it.

Snippet viewer showing generated Python code

View a snippet in a read-only editor tab with syntax highlighting.

The callouts in the image above correspond to the following actions in the snippet view:

  1. Run the snippet in the active console by clicking the Run in Console icon in the editor toolbar.
  2. Copy the snippet code by clicking the Copy to Clipboard icon in the editor toolbar.
  3. Run the snippet in the active console by clicking the Run in Console code lens above the first line of code.
  4. Copy the snippet code by clicking the Copy to Clipboard code lens above the first line of code.

Running a snippet

  1. Right-click an authenticated integration.
  2. Select Run Python Snippet or Run R Snippet.

The snippet executes directly in the active console, so you can immediately inspect the returned credentials.

Generated snippet examples

The generated snippets use the integration’s GUID to retrieve credentials:

from posit.workbench import Client

client = Client()
credentials = client.oauth.get_credentials(audience="{integration_id}")

if credentials:
    access_token = credentials["access_token"]
    # Use access_token with your API requests
credentials <- rstudioapi::getOAuthCredentials(audience = "{integration_id}")

if (!is.null(credentials)) {
  access_token <- credentials$access_token
  # Use access_token with your API requests
}

For more details on using these SDKs, including token refresh, error handling, and finding integrations programmatically, see Custom OAuth Integrations: Using credentials in sessions.

Command palette commands

The following commands are available from the command palette (Ctrl+Shift+P / Cmd+Shift+P) under the Posit Workbench category:

Command Description
Refresh Available Credentials Manually refresh the credentials list.
View Credential Code Snippet Open a read-only editor tab with the generated code snippet for the selected integration.
Copy Credential Code Snippet Copy the generated code snippet for the selected integration to the clipboard.
Run Credential Code Snippet in Console Run the generated code snippet for the selected integration in the active console.
Back to top