Keycloak (keycloak v1.1.0) View Source
An OAuth2.Strategy implementation for authorizing with a Keycloak server.
Example
Phoenix controller
def login(conn, _) do
redirect(conn, external: Keycloak.authorize_url!())
end
def callback(conn, %{"code" => code}) do
%{token: token} = Keycloak.get_token!(code: code)
conn
|> put_session(:token, token)
|> redirect(to: "/manage")
end
Link to this section Summary
Functions
Returns the authorize url for the keycloak client.
Gets a token given a preconfigured OAuth2.Client.
Creates a OAuth2.Client using the keycloak configuration and
attempts fetch a access token.
Link to this section Functions
Specs
authorize_url( OAuth2.Client.t(), keyword() ) :: any()
Returns the authorize url for the keycloak client.
Specs
get_token(OAuth2.Client.t(), keyword(), keyword()) :: any()
Gets a token given a preconfigured OAuth2.Client.
Specs
Creates a OAuth2.Client using the keycloak configuration and
attempts fetch a access token.