<img align="left" src="" width="150px" style="margin-right: 15px">

# oidcc_cowboy

[![EEF Security WG project](](
[![Main Branch](](
[![Module Version](](
[![Total Download](](
[![Last Updated](](
[![Coverage Status](](

Cowboy callback module for easy integration of OpenId Connect, using [oidcc](

<!-- TODO: Uncomment after certification -->
OpenID Certified by Jonatan Männchen at the Erlang Ecosystem Foundation for the
basic and configuration profile of the OpenID Connect protocol. For details,
check the [Conformance Documentation](

![OpenID Connect Certified Logo](

<picture style="margin-right: 15px; float: left">
  <source media="(prefers-color-scheme: dark)" srcset="" width="115px" align="left">
  <source media="(prefers-color-scheme: light)" srcset="" width="115px" align="left">
  <img alt="Erlang Ecosystem Foundation Logo" src="" width="115px" align="left">

The refactoring for `v2` and the certification is funded as an
[Erlang Ecosystem Foundation]( stipend entered by the
[Security Working Group](

## Usage



start(_, _) ->
    OidccCowboyOpts = #{
        provider => config_provider_gen_server_name,
        client_id => <<"client_id">>,
        client_secret => <<"client_secret">>,
        redirect_uri => "http://localhost:8080/oidc/return"
    OidccCowboyCallbackOpts = maps:merge(OidccCowboyOpts, #{
        handle_success => fun(Req, _Token, #{<<"sub">> := Subject}) ->
            cowboy_req:reply(200, #{}, ["Hello ", Subject, "!"], Req)
    Dispatch = cowboy_router:compile([
        {'_', [
            {"/", oidcc_cowboy_authorize, OidccCowboyOpts},
            {"/oidc/return", oidcc_cowboy_callback, OidccCowboyCallbackOpts}
    {ok, _} = cowboy:start_clear(http, [{port, 8080}], #{
        env => #{dispatch => Dispatch}

stop(_) ->