Why doesn't Absinthe expose Plug.Conn?

Have you looked at the context and authentication guide in the docs? https://hexdocs.pm/absinthe/context-and-authentication.html#context-and-plugs
You create a plug and call Absinthe.Plug.put_options(conn, context: context) where context has something like: {current_user: user, login_count: 9} and whatever other info you need in your resolvers for your context.

I’d recommend looking into Pow: Robust, modular, extendable user authentication and management system for the authentication if you don’t currently have anything, but plain hand-rolled cookies can be fine too, although I don’t have any guides handy for that.

Edit: sent early

2 Likes