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
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? ![]()
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 }
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #javascript
- #code-sync
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








