woohaaha

woohaaha

GraphiQL + Absinthe + Session/Cookie

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

In general there are the desktop clients:
https://github.com/skevy/graphiql-app
https://github.com/prisma-labs/graphql-playground

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

First Post!

woohaaha

woohaaha

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:

Update:

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 }

Where Next?

Popular in Questions Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New

Other popular topics Top

hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New

We're in Beta

About us Mission Statement