{"action":"opened","issue":{"url":"https://api.github.com/repos/mattjbray/servant-elm/issues/11","repository_url":"https://api.github.com/repos/mattjbray/servant-elm","labels_url":"https://api.github.com/repos/mattjbray/servant-elm/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/mattjbray/servant-elm/issues/11/comments","events_url":"https://api.github.com/repos/mattjbray/servant-elm/issues/11/events","html_url":"https://github.com/mattjbray/servant-elm/issues/11","id":182966811,"number":11,"title":"Possibility to Generate For `AuthProtect` endpoints?","user":{"login":"pellagic-puffbomb","id":4587833,"avatar_url":"https://avatars.githubusercontent.com/u/4587833?v=3","gravatar_id":"","url":"https://api.github.com/users/pellagic-puffbomb","html_url":"https://github.com/pellagic-puffbomb","followers_url":"https://api.github.com/users/pellagic-puffbomb/followers","following_url":"https://api.github.com/users/pellagic-puffbomb/following{/other_user}","gists_url":"https://api.github.com/users/pellagic-puffbomb/gists{/gist_id}","starred_url":"https://api.github.com/users/pellagic-puffbomb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pellagic-puffbomb/subscriptions","organizations_url":"https://api.github.com/users/pellagic-puffbomb/orgs","repos_url":"https://api.github.com/users/pellagic-puffbomb/repos","events_url":"https://api.github.com/users/pellagic-puffbomb/events{/privacy}","received_events_url":"https://api.github.com/users/pellagic-puffbomb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-14T05:30:32Z","updated_at":"2016-10-14T05:30:32Z","closed_at":null,"body":"Hello,\r\n\r\nI have been using this library in a personal project and it's pretty damn cool. Thank you for writing it and for releasing it. \r\n\r\nI did have a question, though, about `AuthProtect` endpoints. I have been using the [`servant-auth-cookie`](https://github.com/zohl/servant-auth-cookie) library to generate sessions and enforce authentication for certain endpoints, but I have not been able to use servant-elm to generate Api calls for these endpoints.\r\n\r\nMaybe an example would be illustrative. With an endpoint like this:\r\n\r\n```\r\ntype AdminApi = \r\n  \"admin\" :> AuthProtect \"cookie-auth\" :> Get '[HTML] Html\r\n  :<|> \"admin\" :> \"post\" :> ReqBody '[JSON] Post.BlogPost :> AuthProtect \"cookie-auth\" :> Post '[JSON] Post.BlogPost\r\n```\r\n\r\nIf I try to generate Elm for this using `servant-elm`, I get a compiler error like this:\r\n\r\n```\r\nclient/GenerateElm.hs:21:9: error:\r\n    • No instance for (Servant.Foreign.Internal.HasForeign\r\n                         servant-elm-0.1.0.2:Servant.Elm.Foreign.LangElm\r\n                         elm-export-0.3.0.0:Elm.Type.ElmTypeExpr\r\n                         (Servant.API.Experimental.Auth.AuthProtect \"cookie-auth\"\r\n                          Servant.API.Sub.:> Servant.API.Verbs.Post\r\n                                               '[Servant.API.ContentTypes.JSON]\r\n                                               Post.BlogPost))\r\n        arising from a use of ‘generateElmForAPI’\r\n    • In the second argument of ‘(:)’, namely\r\n        ‘generateElmForAPI adminProxyApi’\r\n      In the second argument of ‘(:)’, namely\r\n        ‘defElmImports : generateElmForAPI adminProxyApi’\r\n      In the second argument of ‘(:)’, namely\r\n        ‘\"import Exts.Date exposing (..)\"\r\n         : defElmImports : generateElmForAPI adminProxyApi’\r\nmake: *** [Api.elm] Error 1\r\n```\r\n\r\nAm I doing something wrong or must there be an instance defined to be able to handle `AuthProtect`ed endpoints?\r\n\r\nThanks for any suggestions."}}
{"actor":{"display_login":"pellagic-puffbomb"}}