This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-11-16
Channels
- # announcements (62)
- # babashka (12)
- # babashka-sci-dev (73)
- # beginners (16)
- # biff (10)
- # calva (65)
- # cider (13)
- # clerk (8)
- # clojure (31)
- # clojure-europe (16)
- # clojure-nl (1)
- # clojure-norway (19)
- # clojure-spec (24)
- # clojure-uk (5)
- # clojuredesign-podcast (18)
- # clojurescript (18)
- # dev-tooling (2)
- # emacs (30)
- # etaoin (4)
- # gratitude (3)
- # hyperfiddle (20)
- # integrant (2)
- # jobs (4)
- # kaocha (7)
- # malli (1)
- # observability (11)
- # off-topic (11)
- # pathom (12)
- # podcasts-discuss (7)
- # portal (12)
- # quil (3)
- # re-frame (6)
- # releases (1)
- # sql (22)
- # squint (5)
- # testing (79)
- # tools-deps (3)
- # xtdb (20)
Been working with the pathom3 graphql integration
In the demo examples, I see authorization tokens being used in the github example, but the token is an env variable constant for any request.
In my example, I have a pathom plugin authenticating the user from a JWT, and I want to pass this user-specific account information to my backend graphql instance, ideally via headers.
However, p.gql/connect-graphql
's request fn only takes in the query, not the environment, so I'm having trouble figuring out how to pass this information along. Would a PR be accepted that allows for the environment to be passed into this fn as well? or is there a better way to accomplish this?
essentially something that looks like:
(defn auth-header-map [env]
(if-let [acct-info (lib.auth/get-account-info env)]
acct-info
{}))
(defn request-vb-graphql
"helper fn required by p.gql/connect-graphql to make graphql requests"
[env query]
#?(:clj
(let [{:keys [host port]} (:config config)]
(-> @(http/request
{:url (str "http://" host ":" (str port) "/graphql")
:method :post
:headers (merge {"Content-Type" "application/json"
"Accept" "*/*"}
(auth-header-map env))
:body (json/write-str {:query query})})
:body
json/read-str))))
hello @U016TR1B18E, yeah, I think we will need to add also the environment, happy to discuss the change on a PR
Sounds good! gonna Open a PR with a breaking change here, but happy to discuss non-breaking alternatives and make the proper changes -- figured this'll just be a good starting point https://github.com/wilkerlucio/pathom3-graphql/pull/17
Hey Wilker, was wondering if you're still interested in the above PR? No real urgency on my part, just wanted to check in case it slipped your mind. Let me know if/how i can help get it over the finish line!
hello Tyler, sorry, all the end of year things made me lose track of this, I'll have a look later today 😉
no problem at all!
Awesome!
@U066U8JQJ would you be up for cutting a new release of https://github.com/wilkerlucio/pathom3-graphql given this is merged?
hey @U016TR1B18E, sorry the delay. I actually tried to do this the other day, but there are some new requirements on clojars that I have to fix to make a new release, I'll let you know once I get to it
All good appreciate it!