Skip to content

Credentials helpers

These helpers let you inspect and manage the active credentials profile used by the SDK.

Get current profile

import digitalhub as dh

profile = dh.get_current_profile()

get_current_profile()

Get the name of the current credentials profile.

Returns:

Type Description
str

Name of the current credentials profile.

Set current profile

import digitalhub as dh

dh.set_current_profile("other-env")

set_current_profile(profile)

Set the current credentials profile.

Parameters:

Name Type Description Default
profile str

Name of the credentials profile to set.

required

Get credentials and config

import digitalhub as dh

config = dh.get_credentials_and_config()

get_credentials_and_config()

Get current client credentials and configuration.

Returns:

Type Description
dict

Current client credentials and configuration details.

Refresh token

Use this only if your profile uses OAuth2 credentials and you need a manual refresh.

import digitalhub as dh

dh.refresh_token()

refresh_token()

Refresh the current OAuth2 access token.

Uses the refresh token stored in client configuration to obtain a new access token. Requires OAuth2 authentication configuration.