GraphiQL + Absinthe + Session/Cookie

How do ya’ll handle setting cookies in GraphiQL? (Not GraphQL)

In general there are the desktop clients:

But I’m just wondering if there’s another way to create queries in development mode without one of those clients. This will be useful for making api calls that are supposed to be authenticated.

Thank you

I’m not seeing how to update this question… I have been trying to send a cookie with those clients I have listed above but it’s not clear to me.

How can I set and send cookie data with GraphiQL and absinthe?

Maybe I’m not asking the right question. I am setting the plug_session with a user_id after a user registers to the application, and then rendering a page that has an SPA on it. That SPA will then make GraphQL requests to the application (under the /api/graphql path). I am not sending any current_user id from the client but rather assuming the plug_session is already set with the user_id. So far this seems to work and I can use it to get the user_id from the session and pass it to the Absinthe context. But how can I work with this configuration using the GraphiQL tool? I have set the interface: :advanced but it’s still not clear to me what I have to do? :thinking:


A workaround I am using is adding another scope with its own pipeline in the router. There is a plug that Absinthe.Plug.put_options(conn, context: context) where context is %{ current_user: HardCodedUserGoesHere }