authable v0.9.1 Authable.Helper
Authable helper to check authentications with scopes and returns resouce owner.
Link to this section Summary
Functions
Authenticate user by using configured authorization methods and scopes
Link to this section Functions
Link to this function
authorize_for_resource(conn, scopes)
Authenticate user by using configured authorization methods and scopes.
Examples
required_scopes = ~w(read write)
result = Authable.Plug.Authenticate.authorize_for_resource(conn,
required_scopes)
case result do
{:error, errors, _} -> IO.inspect(errors)
nil -> IO.puts("not authencated!")
{:ok, current_user} -> IO.puts(current_user.email)
end