Forcex v0.8.0 Forcex.Client

This client delegates login to the appropriate endpoint depending on the type of credentials you have, and upon successful authentication keeps track of the authentication headers you’ll need for subsequent calls.

Link to this section Summary

Link to this section Functions

Link to this function default_config()
Link to this function locate_services(client)
Link to this function login(config \\ default_config())

Initially signs into Force.com API.

Login credentials may be supplied. Order for locating credentials:

  1. Map supplied to login/1
  2. Environment variables
  3. Applications configuration

Supplying a Map of login credentials must be in the form of

%{
  username: "...",
  password: "...",
  security_token: "...",
  client_id: "...",
  client_secret: "...",
  endpoint: "..."
}

Environment variables

  • SALESFORCE_USERNAME
  • SALESFORCE_PASSWORD
  • SALESFORCE_SECURITY_TOKEN
  • SALESFORCE_CLIENT_ID
  • SALESFORCE_CLIENT_SECRET
  • SALESFORCE_ENDPOINT

Application configuration

config :forcex, Forcex.Client,
  username: "user@example.com",
  password: "my_super_secret_password",
  security_token: "EMAILED_FROM_SALESFORCE",
  client_id: "CONNECTED_APP_OAUTH_CLIENT_ID",
  client_secret: "CONNECTED_APP_OAUTH_CLIENT_SECRET",
  endpoint: "login.salesforce.com"

If no client_id is passed login via session id will be attempted with security_token.

Will require additional call to locate_services/1 to identify which Force.com services are availabe for your deployment.

client =
  Forcex.Client.login
  |> Forcex.Client.locate_services
Link to this function login(conf, starting_struct)