FusionAuth.Login (FusionAuth v0.3.0) View Source
The FusionAuth.Login
module provides access methods to the FusionAuth Login API.
If an Application ID is not specified no refresh token will return in the response when logging in a user.
All methods require a Tesla Client struct created with FusionAuth.client(base_url, api_key)
.
Link to this section Summary
Functions
Login user with one time password. Default application_id will be applied if specified in Application config.
Login user with one time password and application_id. No default application_id will be applied.
Login user with one time password, application_id, and options. No default application_id will be applied.
Login user with login_id and password. Default application_id will be applied if specified in Application config.
Login user with login_id, password and additional options. Default application_id will be applied if specified in Application config.
Login user with application_id, login_id, password and additional options. No default application_id will be applied.
Logout user and invalidate refresh token.
Search user login.
Login user with two factor authentication. Default application_id will be applied if specified in Application config.
Login user with two factor authentication for specified application. No application_id will be applied if specified in Application config.
Login user with two factor authentication for specified application and additional options. No application_id will be applied if specified in Application config.
Record user login. Default application_id will be applied if specified in Application config.
Record user login with application_id. No application_id will be applied if specified in Application config.
Record user login with application_id and ip address. No application_id will be applied if specified in Application config.
Link to this section Types
Link to this section Functions
Specs
Login user with one time password. Default application_id will be applied if specified in Application config.
Example
iex> client = FusionAuth.client()
iex> FusionAuth.Login.login_one_time_password(client, "YkQY5Gsyo4RlfmDciBGRmvfj3RmatUqrbjoIZ19fmw4")
{
:ok,
%{
"refreshToken" => "xesneAYTdwF42uWM0dHRLgHp0_f1DsHOiNMXHN-ZCHvtRYX-MgvJUg",
"token" => "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Im53bE0zLUZNdm9jVEFPWWlxVXpadDlZNjE1ayJ9.eyJhdWQiOiI4NjFmNTU1OC0zNGE4LTQzZTQtYWI1MC0zMTdiZGNkNDc2NzEiLCJleHAiOjE1OTE2NTIxOTUsImlhdCI6MTU5MTY0ODU5NSwiaXNzIjoiYWNtZS5jb20iLCJzdWIiOiI4NDg0Njg3My04OWQyLTQ0ZjgtOTFlOS1kYWM4MGY0MjBjYjIiLCJhdXRoZW50aWNhdGlvblR5cGUiOiJQQVNTV09SRCIsImVtYWlsIjoiY2tlbXB0b25AY29naWxpdHkuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsInByZWZlcnJlZF91c2VybmFtZSI6ImNrZW1wdG9uIiwiYXBwbGljYXRpb25JZCI6Ijg2MWY1NTU4LTM0YTgtNDNlNC1hYjUwLTMxN2JkY2Q0NzY3MSIsInJvbGVzIjpbImFkbWluIl19.cZI203pyGAej9DPCxIQ0URakZkgNHO0DCC270qbeR-W-QbMgKERdgNmoOtnimQTxfUAdaipbCH7VVorblvlWZlRlTHd6qCUX5x7A9J0ww1xQincCeOgX-54tAybVMUVgxYvmoyxkx2Pea4MuuJXc3ut43yFXK3MtmSO7HnE5eChHMCw8GNhq71IP3TuTsnkdUHgdvJDF9NalsuxWZ4Ua2sIkIWNVB-XpUXArQd02q6XHY9p8OKe8ordmA-Vpw6nFMnY-naAhWV6MshTDyRXtE-_s5sDiE5xHszuiO40DZVo8Cqmu81gM41jPO9OQbFqFbyQN-WCPBdq8AuN79HF_zQ",
"user" => %{...}
},
%Tesla.Env{...}
}
For more information visit the FusionAuth API Documentation for Authenticate a User with a One Time Password
login_one_time_password(client, application_id, one_time_password)
View SourceSpecs
Login user with one time password and application_id. No default application_id will be applied.
For more information visit the FusionAuth API Documentation for Authenticate a User with a One Time Password
login_one_time_password(client, application_id, one_time_password, options)
View SourceSpecs
Login user with one time password, application_id, and options. No default application_id will be applied.
For more information visit the FusionAuth API Documentation for Authenticate a User with a One Time Password
Specs
Login user with login_id and password. Default application_id will be applied if specified in Application config.
Example
iex> client = FusionAuth.client()
iex> FusionAuth.Login.login_user(client, "username", "password")
{
:ok,
%{
"refreshToken" => "xesneAYTdwF42uWM0dHRLgHp0_f1DsHOiNMXHN-ZCHvtRYX-MgvJUg",
"token" => "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Im53bE0zLUZNdm9jVEFPWWlxVXpadDlZNjE1ayJ9.eyJhdWQiOiI4NjFmNTU1OC0zNGE4LTQzZTQtYWI1MC0zMTdiZGNkNDc2NzEiLCJleHAiOjE1OTE2NTIxOTUsImlhdCI6MTU5MTY0ODU5NSwiaXNzIjoiYWNtZS5jb20iLCJzdWIiOiI4NDg0Njg3My04OWQyLTQ0ZjgtOTFlOS1kYWM4MGY0MjBjYjIiLCJhdXRoZW50aWNhdGlvblR5cGUiOiJQQVNTV09SRCIsImVtYWlsIjoiY2tlbXB0b25AY29naWxpdHkuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsInByZWZlcnJlZF91c2VybmFtZSI6ImNrZW1wdG9uIiwiYXBwbGljYXRpb25JZCI6Ijg2MWY1NTU4LTM0YTgtNDNlNC1hYjUwLTMxN2JkY2Q0NzY3MSIsInJvbGVzIjpbImFkbWluIl19.cZI203pyGAej9DPCxIQ0URakZkgNHO0DCC270qbeR-W-QbMgKERdgNmoOtnimQTxfUAdaipbCH7VVorblvlWZlRlTHd6qCUX5x7A9J0ww1xQincCeOgX-54tAybVMUVgxYvmoyxkx2Pea4MuuJXc3ut43yFXK3MtmSO7HnE5eChHMCw8GNhq71IP3TuTsnkdUHgdvJDF9NalsuxWZ4Ua2sIkIWNVB-XpUXArQd02q6XHY9p8OKe8ordmA-Vpw6nFMnY-naAhWV6MshTDyRXtE-_s5sDiE5xHszuiO40DZVo8Cqmu81gM41jPO9OQbFqFbyQN-WCPBdq8AuN79HF_zQ",
"user" => %{...}
},
%Tesla.Env{...}
}
For more information visit the FusionAuth API Documentation for Authenticate a User
Specs
login_user(client(), String.t(), String.t(), options()) :: result()
login_user(client(), String.t(), String.t(), String.t()) :: result()
Login user with login_id, password and additional options. Default application_id will be applied if specified in Application config.
For more information visit the FusionAuth API Documentation for Authenticate a User
Specs
Login user with application_id, login_id, password and additional options. No default application_id will be applied.
For more information visit the FusionAuth API Documentation for Authenticate a User
Logout user and invalidate refresh token.
Example
iex> client = FusionAuth.client()
iex> FusionAuth.Login.logout_user(client, "xesneAYTdwF42uWM0dHRLgHp0_f1DsHOiNMXHN-ZCHvtRYX-MgvJUg", false)
{:ok, "", %Tesla.Env{...}}
For more information visit the FusionAuth API Documentation for Logout a User
Specs
search(client(), search_parameters()) :: result()
Search user login.
Example
iex> client = FusionAuth.client()
iex> FusionAuth.Login.search(client, %{userId: "d7be5e1e-0020-4f6f-a9dc-0f9230650042"})
{
:ok,
%{
"logins" => [
%{
"applicationId" => "2edd54c6-695d-409e-b8af-2d3ebf73711a",
"applicationName" => "applicationName",
"loginId" => "loginId",
"instant" => 1562608320303,
"ipAddress" => "0.0.0.0",
"userId" => "d7be5e1e-0020-4f6f-a9dc-0f9230650042"
},
...
]
},
%Tesla.Env{...}}
For more information visit the FusionAuth API Documentation for Search Login Records
Specs
Login user with two factor authentication. Default application_id will be applied if specified in Application config.
## Example
iex> client = FusionAuth.client()
iex> FusionAuth.Login.two_factor_login(client, "12345", "YkQY5Gsyo4RlfmDciBGRmvfj3RmatUqrbjoIZ19fmw4")
{
:ok,
%{
"refreshToken" => "xesneAYTdwF42uWM0dHRLgHp0_f1DsHOiNMXHN-ZCHvtRYX-MgvJUg",
"token" => "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Im53bE0zLUZNdm9jVEFPWWlxVXpadDlZNjE1ayJ9.eyJhdWQiOiI4NjFmNTU1OC0zNGE4LTQzZTQtYWI1MC0zMTdiZGNkNDc2NzEiLCJleHAiOjE1OTE2NTIxOTUsImlhdCI6MTU5MTY0ODU5NSwiaXNzIjoiYWNtZS5jb20iLCJzdWIiOiI4NDg0Njg3My04OWQyLTQ0ZjgtOTFlOS1kYWM4MGY0MjBjYjIiLCJhdXRoZW50aWNhdGlvblR5cGUiOiJQQVNTV09SRCIsImVtYWlsIjoiY2tlbXB0b25AY29naWxpdHkuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsInByZWZlcnJlZF91c2VybmFtZSI6ImNrZW1wdG9uIiwiYXBwbGljYXRpb25JZCI6Ijg2MWY1NTU4LTM0YTgtNDNlNC1hYjUwLTMxN2JkY2Q0NzY3MSIsInJvbGVzIjpbImFkbWluIl19.cZI203pyGAej9DPCxIQ0URakZkgNHO0DCC270qbeR-W-QbMgKERdgNmoOtnimQTxfUAdaipbCH7VVorblvlWZlRlTHd6qCUX5x7A9J0ww1xQincCeOgX-54tAybVMUVgxYvmoyxkx2Pea4MuuJXc3ut43yFXK3MtmSO7HnE5eChHMCw8GNhq71IP3TuTsnkdUHgdvJDF9NalsuxWZ4Ua2sIkIWNVB-XpUXArQd02q6XHY9p8OKe8ordmA-Vpw6nFMnY-naAhWV6MshTDyRXtE-_s5sDiE5xHszuiO40DZVo8Cqmu81gM41jPO9OQbFqFbyQN-WCPBdq8AuN79HF_zQ",
"user" => %{...}
},
%Tesla.Env{...}
}
For more information visit the FusionAuth API Documentation for Complete Two Factor Authentication
Specs
Login user with two factor authentication for specified application. No application_id will be applied if specified in Application config.
For more information visit the FusionAuth API Documentation for Complete Two Factor Authentication
two_factor_login(client, application_id, code, two_factor_id, options)
View SourceSpecs
Login user with two factor authentication for specified application and additional options. No application_id will be applied if specified in Application config.
For more information visit the FusionAuth API Documentation for Complete Two Factor Authentication
Specs
Record user login. Default application_id will be applied if specified in Application config.
Example
iex> client = FusionAuth.client()
iex> FusionAuth.Login.update_login_instant(client, "84846873-89d2-44f8-91e9-dac80f420cb2")
{:ok, "", %Tesla.Env{...}}
For more information visit the FusionAuth API Documentation for Update Login Instant
Specs
update_login_instant(client(), String.t(), String.t() | nil) :: result()
update_login_instant(client(), String.t(), boolean()) :: result()
Record user login with application_id. No application_id will be applied if specified in Application config.
For more information visit the FusionAuth API Documentation for Update Login Instant
Specs
Record user login with application_id and ip address. No application_id will be applied if specified in Application config.
For more information visit the FusionAuth API Documentation for Update Login Instant