In one of the projects that I work on, we need json api authenticated by cookies. With AshJson I can put the forwarded jsonrouter through a pipeline like
scope "/", HelloWeb do
pipe_through :api
forward "/api", ApiRouter
end
and in the :api
pipeline, I can fetch the cookies and set the context. However, I am facing issue with login, register and logout api endpoints where I need to set or clear the cookies. As AshJsonApi doesn’t expose any controller and does all the magic of rendering the JSON through the domain model, I’m wondering how I can intercept AshJsonAPI to set cookie values or should I just go plain old controllers without Ash for login/register/logout apis and use AshJsonApi for the rest?
Thanks for your inputs!