This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-04-28
Channels
- # asami (13)
- # babashka (6)
- # beginners (38)
- # calva (14)
- # cider (15)
- # circleci (13)
- # clj-kondo (4)
- # cljsrn (18)
- # clojure (164)
- # clojure-bay-area (3)
- # clojure-europe (46)
- # clojure-italy (8)
- # clojure-losangeles (3)
- # clojure-norway (3)
- # clojure-sweden (24)
- # clojure-uk (115)
- # clojurescript (79)
- # cursive (11)
- # datomic (24)
- # docker (2)
- # events (9)
- # figwheel-main (31)
- # fulcro (5)
- # honeysql (6)
- # jackdaw (7)
- # jobs (3)
- # jobs-discuss (16)
- # joker (1)
- # kaocha (6)
- # keechma (1)
- # lein-figwheel (1)
- # malli (6)
- # pathom (10)
- # podcasts-discuss (13)
- # practicalli (3)
- # react (4)
- # reagent (3)
- # reitit (8)
- # remote-jobs (3)
- # shadow-cljs (21)
- # sql (12)
- # tools-deps (20)
- # xtdb (24)
Today’s episode of ClojureScript Podcast is with @miikka about Reitit — check it out https://clojurescriptpodcast.com
Hey, I use reitit for the frontend and have use-fragments
set to false
. But now jump links do not seem to work, i.e. when a link http://example.com#any-id is klicked, nothing happens. Is this a reitit thing, or am I looking in the wrong direction?
Okay, the solution is actually in the docs for anyone looking: https://cljdoc.org/d/metosin/reitit/0.5.12/api/reitit.frontend.easy
:ignore-anchor-click?
is customizable and takes a function.
Yes, it's also explain in this part of this vid: https://youtu.be/ChUzrcB9L1c?t=551
Hi. Is it possible to configure authorizations when using reitit-swagger? What I am trying to accomplish, is a Authorize-button in upper right corner where I can provide a token on a global level. Example of Swagger docs with such button: https://api.prodreg.no/restapi/v1/doc3/#/ So far we have only added authorization header to routes:
(ring/router
...
["/client" {:parameters {:header [:map schema/AccessToken]}
...
(def token-pattern #"^Bearer (.+)$")
(def AccessToken [:authorization
{:description "SSO access token"
:json-schema/example "Bearer eyJhbGciOiJS..."}
[:re token-pattern]])
But then I need to provide token for each invocationLooks like I’m onto something:
{:get {:no-doc true
:swagger {:info {:title "Title"
:description "Desc"}
:securityDefinitions {}}
:handler (swagger/create-swagger-handler)}}
After adding :securityDefinitions {}
I got the Authorize button
Now I just need to figure out what to put inside {}
Finally got it working:
:securityDefinitions {:bearerAuth {:type "apiKey" :name "Authorization" :in "header"}}
In addition, routes must be configured to use this securityDefinition:
["/client" {:swagger {:security [{:bearerAuth []}]}}
...
Documentation: https://swagger.io/docs/specification/2-0/authentication/
What got me on the right track was this example, although it has empty :securityDefinitions
: https://github.com/metosin/ring-swagger/blob/master/test/ring/swagger/swagger2_test.clj:security [{:bearerAuth []}]
can be set alongside securityDefinitions as well:
["/swagger.json" {:get {:no-doc true
:swagger {:info {:title "Title"
:description "Desc"}
:security [{:bearerAuth []}]
:securityDefinitions {:bearerAuth {:type "apiKey" :name "Authorization" :in "header"}}}
:handler (swagger/create-swagger-handler)}}]