This is a modern servant wrapper around the wai-middleware-auth OAuth2 provider implementations.
Documentation:
- https://tweag.github.io/servant-oauth2/servant-oauth2/
- https://tweag.github.io/servant-oauth2/servant-oauth2-examples/
See the examples. The recommended approach is to read through the examples in order: 1) simple, 2) cookies, 3) authorised; but feel free to approach it in the way that suits you best :)
./hack example-basic
./hack example-cookies
Example that performs "authorisation" (i.e. there is an 'admin' section):
./hack example-auth
You'll need to make a GitHub OAuth application, and a Google one, if you want to test that as well.
The details of which you'll need to place in ./config.toml
. See
./config.example.toml
for an example.
The most important detail is that the callback URL on github, and in the config, is set to the same thing:
http://localhost:8080/auth/github/complete
- Contributing guide
- Document exported functions
- More detailed readme documentation
- Build in an example of 'Authorisation'; i.e. lifting the logins to the type-level
- Show an example of multiple auths (distinguish by type)
- See if we can get away with only doing it for
complete
- Pass settings through somehow
- Try and hide away as much details as possible
- Define a basic structure following
AuthProtect
Thanks to tchoutri and crew for the awesome work on flora-server which partially-inspired this project!