snowflakeauth is a toolkit for authenticating with Snowflake. It aims for compatibility with the connections.toml and config.toml files used by the Snowflake Connector for Python and the Snowflake CLI, so that R users can use a consistent approach to Snowflake credentials across both languages.
snowflakeauth is intended for use by R package authors targeting the Snowflake platform.
Installation
You can install snowflakeauth from CRAN with:
install.packages("snowflakeauth")Or, install the development version of snowflakeauth from GitHub with:
# install.packages("pak")
pak::pak("posit-dev/snowflakeauth")Example
snowflakeauth can pick up on the default Snowflake connection parameters from the connections.toml and config.toml files used by the Python Connector for Snowflake and the Snowflake CLI (or any other named connection, for that matter):
library(snowflakeauth)
snowflake_connection()
snowflake_connection(name = "testing")or you can define the parameters of a connection manually:
snowflake_connection(
account = "myaccount",
user = "me",
private_key_file = "rsa_key.p8",
private_key_file_pwd = "supersecret"
)These parameters can then be used to retrieve credentials, which take the form of a one or more of HTTP headers:
conn <- snowflake_connection(
account = "myaccount",
user = "myuser@company.com",
authenticator = "externalbrowser"
)
snowflake_credentials(conn)Supported Authentication Methods
The following table details authentication methods supported by snowflake_credentials():
| Method | Supported | Notes |
|---|---|---|
| Browser-based SSO | ✅ | Interactive, desktop-only |
| Key-pair | ✅ | |
| OAuth token | ✅ | |
| Workload identity federation | ❌ | |
| Programmatic access token (PAT) | ❌ | |
| OAuth 2.0 client credentials | ❌ | Rarely used, not planned |
| OAuth 2.0 authorization code | ❌ | Rarely used, not planned |
| Username and password | ❌ | Insecure, not planned |
| Username and password with MFA | ❌ | Not planned |
| Native SSO (Okta-only) | ❌ | Superceded by other methods, not planned |
Limitations
Browser-based authentication is known to fail in Positron, but should work in RStudio.
No support for on-disk connection caching.
License
MIT (c) Posit Software, PBC