[Haskell-cafe] Authenticated APIs in Servant

erik eraker at gmail.com
Mon Mar 13 02:18:22 UTC 2017


I don't know if this will be useful to you (and it may be poorly done), but
I've been slowly cobbling together my personal profile site using servant
and elm for the frontend, just for fun.

I have an admin/cms-type thing I've been doing a hack job of building (I
often get distracted by other projects).

Anyway, here's the login for it, which sets an auth cookie (and relies on
the *users* library) and uses a form:

https://github.com/pellagic-puffbomb/simpleservantblog/blob/master/src/Api/Admin/Login.hs

Here are the actual auth-protected APIs:

https://github.com/pellagic-puffbomb/simpleservantblog/blob/master/src/Api/Admin/Admin.hs

I'm not sure if it'll help much, but there it is.

Erik


On Mar 12, 2017 5:42 PM, "Ivan Lazar Miljenovic" <ivan.miljenovic at gmail.com>
wrote:

Thanks!

On 13 March 2017 at 11:30, Simon Hafner <hafnersimon at gmail.com> wrote:
> I have a bunch of changes based on hoauth2 lying around, and some
> connector code to servant. It will need some cleaning up before I can
> release it. I'll have a go at it tomorrow.
>
> 2017-03-13 1:20 GMT+01:00 Ivan Lazar Miljenovic <ivan.miljenovic at gmail.com
>:
>> I'm needing to write and deploy a web API with authenticated
>> endpoints.  I was planning on using Servant, but it looks like there
>> is still no in-built support for OAuth-style token-based APIs.  Is
>> that correct, or did I miss something?
>>
>> (That said, the actual API is of a "submit one POST and get a response
>> back" style rather than continuing to do more requests, so a
>> username/password basic authentication approach may also work if all
>> else fails.)
>>
>> --
>> Ivan Lazar Miljenovic
>> Ivan.Miljenovic at gmail.com
>> http://IvanMiljenovic.wordpress.com
>> _______________________________________________
>> Haskell-Cafe mailing list
>> To (un)subscribe, modify options or view archives go to:
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>> Only members subscribed via the mailman list are allowed to post.
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.



--
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
http://IvanMiljenovic.wordpress.com
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170312/04b80904/attachment.html>


More information about the Haskell-Cafe mailing list