keycloak v0.2.0 Keycloak.Service View Source

Module that handles authorization flow for a client credentials grant

Example

client = Keycloak.Service.get_token!()

users =
  case Keycloak.Admin.get(client, "/realms/test-realm/users") do
    {:ok, %{body: body}} -> body
    {:error, _} -> []
  end

Link to this section Summary

Functions

Get a token for the configured OAuth2 client

Same as get_token/1 but raises on error

Link to this section Functions

Link to this function get_token(params \\ []) View Source
get_token(keyword) ::
  {:ok, OAuth2.Client.t} |
  {:error, OAuth2.Client.t}

Get a token for the configured OAuth2 client

Example

iex> Keycloak.Service.get_token!() %OAuth2.AccessToken{access_token: “supersecret”, expires_at: nil, other_params: %{}, refresh_token: nil, token_type: “Bearer”}

Link to this function get_token!(params \\ []) View Source
get_token!(keyword) :: {:ok, OAuth2.Client.t}

Same as get_token/1 but raises on error