MPX v0.1.5 Mpx.Authentication
Handles all aspects of authenticating with the Ministry Platform API.
Ministry Platform expects a username and password AND a clientId and Client Secret that are set in the Ministy Platform Api Clients table. We send these parameters along with the grant type of “password” to the server and recieve back a token and refresh token that needs to be sent on subsequent requests to the MP.
Summary
Types
Functions
Specs
authenticate(authentication_opts | nil) ::
{:ok, String.t} |
{:error, String.t}
Authenticate with Ministry Platform.
Takes a keyword list of options in the shape:
[ username: "mp-username",
password: "mp-password",
client_id: "mp-client-id",
client_secret: "mp-client-secret" ]
If keyword options are not passed in, defaults to configuration parameters:
mpx, mp_username: "mp-username",
mp_password: System.get_env("MP_PASSWORD"),
mp_client_id: {:system, "MP_CLIENT_ID"},
mp_client_secret: "mp-client-secret"
Returns {:ok, token}
where token
can be used in subsequent calls to the API
that need to be authenticated or {:error, reason}