User authentication and session management for web applications
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

ocaml-auth: enable MDX on lib/auth.mli, fix broken doc example

Run mdx on lib/auth.mli so the {[ ... ]} odoc block now type-checks.

`Auth.config` ends with `?allow_insecure:bool -> unit -> config`, so
the example was missing the trailing `()`. Wrapped the whole flow in
`let run () = Eio_main.run @@ ...` so the SQLite-backed session
store + HTTP server bind do not execute at mdx test time.

+19 -14
+15 -14
lib/auth.mli
··· 26 26 {2 Quick start} 27 27 28 28 {[ 29 - Eio_main.run @@ fun env -> 30 - Eio.Switch.run @@ fun sw -> 31 - let fs = Eio.Stdenv.fs env in 32 - let http = Requests.v ~sw env in 33 - let store = Auth.Store.v ~sw Eio.Path.(fs / "data" / "auth.db") in 34 - let cfg = 35 - Auth.config ~oauth_provider:Oauth.Github ~client_id:"Iv1.abc" 36 - ~client_secret:"secret" ~base_url:"https://app.com" 37 - ~cookie_secret:"32-char-min" ~http 38 - in 39 - let routes = Auth.routes cfg store in 40 - Respond.run ~net:(Eio.Stdenv.net env) ~port:8080 41 - ~root:Eio.Path.(fs / "static") 42 - routes 29 + let run () = 30 + Eio_main.run @@ fun env -> 31 + Eio.Switch.run @@ fun sw -> 32 + let fs = Eio.Stdenv.fs env in 33 + let http = Requests.v ~sw env in 34 + let store = Auth.Store.v ~sw Eio.Path.(fs / "data" / "auth.db") in 35 + let cfg = 36 + Auth.config ~oauth_provider:Oauth.Github ~client_id:"Iv1.abc" 37 + ~client_secret:"secret" ~base_url:"https://app.com" 38 + ~cookie_secret:"32-char-min" ~http () 39 + in 40 + let routes = Auth.routes cfg store in 41 + Respond.run ~net:(Eio.Stdenv.net env) ~port:8080 42 + ~root:Eio.Path.(fs / "static") 43 + routes 43 44 ]} 44 45 45 46 {2 Session lifecycle}
+4
lib/dune
··· 13 13 ohex 14 14 fmt 15 15 logs)) 16 + 17 + (mdx 18 + (files auth.mli) 19 + (libraries auth oauth respond requests eio eio.core eio.unix eio_main))