ExForce v0.4.0 ExForce.OAuth View Source
Handles OAuth2
Grant Types
authorization_code
: Understanding the Web Server OAuth Authentication Flowpassword
: Understanding the Username-Password OAuth Authentication Flowtoken
: Understanding the User-Agent OAuth Authentication Flowrefresh_token
: Understanding the OAuth Refresh Token Process
Link to this section Summary
Functions
Returns the authorize url based on the configuration.
Fetches an ExForce.OAuthResponse
struct by making a request to the token endpoint.
Link to this section Types
Link to this section Functions
Returns the authorize url based on the configuration.
authorization_code
ExForce.OAuth.authorize_url(
"https://login.salesforce.com",
response_type: "code",
client_id: "client-id",
redirect_uri: "https://example.com/callback"
)
token
ExForce.OAuth.authorize_url(
"https://login.salesforce.com",
response_type: "token",
client_id: "client-id",
redirect_uri: "https://example.com/callback"
)
Link to this function
get_token(url, payload)
View Sourceget_token(ExForce.Client.t() | String.t(), list()) :: {:ok, ExForce.OAuthResponse.t()} | {:error, :invalid_signature | term()}
Fetches an ExForce.OAuthResponse
struct by making a request to the token endpoint.
authorization_code
ExForce.OAuth.get_token(
"https://login.salesforce.com",
grant_type: "authorization_code",
code: "code",
redirect_uri: "https://example.com/callback",
client_id: "client_id",
client_secret: "client_secret"
)
password
ExForce.OAuth.get_token(
"https://login.salesforce.com",
grant_type: "password",
client_id: "client_id",
client_secret: "client_secret",
username: "username",
password: "password" <> "security_token"
)
refresh_token
ExForce.OAuth.get_token(
"https://login.salesforce.com",
grant_type: "refresh_token",
client_id: "client_id",
client_secret: "client_secret",
refresh_token: "refresh_token"
)