Keycloak.Service (keycloak v1.1.0) 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
Link to this section Functions
Specs
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.Client{
token: %OAuth2.AccessToken{},
expires_at: nil,
other_params: %{},
refresh_token: nil,
token_type: "Bearer"
}
Specs
get_token!(keyword()) :: OAuth2.Client.t()
Same as get_token/1
but raises on error