Log in to Salesforce
Log in using Basic (Username-Password) or OAuth 2.0 authenticaion. OAuth does
not require sharing passwords, but will require authorizing salesforcer
as a connected app to view and manage your organization. You will be directed to
a web browser, asked to sign in to your Salesforce account, and to grant salesforcer
permission to operate on your behalf. By default, these user credentials are
cached in a file named .httr-oauth-salesforcer
in the current working directory.
sf_auth( username = NULL, password = NULL, security_token = NULL, login_url = getOption("salesforcer.login_url"), token = NULL, consumer_key = getOption("salesforcer.consumer_key"), consumer_secret = getOption("salesforcer.consumer_secret"), callback_url = getOption("salesforcer.callback_url"), cache = getOption("salesforcer.httr_oauth_cache"), verbose = FALSE )
username |
Salesforce username, typically an email address |
password |
Salesforce password |
security_token |
Salesforce security token. Note: A new security token is generated whenever your password is changed. |
login_url |
a custom login url; defaults to https://login.salesforce.com. If needing to log into a sandbox or dev environment then provide its login URL (e.g. https://test.salesforce.com) |
token |
optional; an actual token object or the path to a valid token
stored as an |
consumer_key, consumer_secret, callback_url |
the "Consumer Key","Consumer Secret",
and "Callback URL" when using a connected app; defaults to the |
cache |
|
verbose |
|
## Not run: # log in using basic authentication (username-password) sf_auth(username = "test@gmail.com", password = "test_password", security_token = "test_token") # log in using OAuth 2.0 # Via brower or refresh of .httr-oauth-salesforcer sf_auth() # log in to a Sandbox environment # Via brower or refresh of .httr-oauth-salesforcer sf_auth(login_url = "https://test.salesforce.com") # Save token and log in using it saveRDS(salesforcer_state()$token, "token.rds") sf_auth(token = "token.rds") ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.