snowflake.snowpark.secrets.get_wif_token¶
- snowflake.snowpark.secrets.get_wif_token(secret_name: str, audience: str) str[source]¶
Get a workload identity federation (WIF) token from Snowflake.
Note
Requires a Snowflake environment with a WIF secret configured and an external access integration that allows the UDF or stored procedure to use that secret. The
audiencemust match the token audience expected by the external system (for example, an OAuth token endpoint URL).- Parameters:
secret_name – The secret reference name bound to the WIF secret.
audience – The intended audience (
aud) for the issued token.
- Returns:
The issued token as a string (typically a JWT).
- Raises:
NotImplementedError – If running outside the Snowflake server environment (including SPCS file-based secret environments, where WIF tokens cannot be minted).
ValueError – If the secret does not exist or is not authorized (when applicable in supported environments).