This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-10-01
Channels
- # beginners (2)
- # boot (1)
- # cljs-dev (126)
- # cljsrn (4)
- # clojars (1)
- # clojure (109)
- # clojure-austin (5)
- # clojure-austria (1)
- # clojure-boston (2)
- # clojure-brasil (33)
- # clojure-canada (1)
- # clojure-russia (1)
- # clojure-spec (62)
- # clojurescript (23)
- # core-async (1)
- # cursive (33)
- # datomic (26)
- # ethereum (2)
- # hoplon (7)
- # jobs (1)
- # lein-figwheel (1)
- # luminus (12)
- # off-topic (4)
- # om (3)
- # om-next (49)
- # perun (2)
- # protorepl (2)
- # specter (6)
- # test-check (1)
- # untangled (2)
- # vim (6)
- # yada (30)
I'm trying to get oAuth2 to work following the example in the repo. I'm running into an error :cause "Context does not contain a :uri-for entry"
, Googling that sends me here:
https://clojurians-log.clojureverse.org/yada/2016-08-23.html
Where the advice was to use vhosts-model. Which seemed to work for the person asking there. But doesn't seem to work for me.
First, you need to use yada.yada/uri-for
? You need to be using the vhosts setup in bidi, and edge shows how to do this (bidi needs to know the vhosts involved in order to generate full URLs).
I suggest comparing your existing solution with edge's and seeing were you've deviated
@bbss I seem to remember that I tried to use the “context" from a fn (defn index [ctx] (prn (uri-for ctx …) “Hello”) that didn’t work, but if I used resource the ctx passed to the response fn contained uri-for
the request context (that gets passed to your response functions, and most callback functions, interceptors, etc.) is the thing to pass into yada.yada/uri-for
This is what I had so far. Maybe something wrong with my routes? I am using the yada.yada/uri-for and vhosts-model.
What I was going for was that (build-routes) can’t be
(defn build-routes []
[“/“ [[“” (fn [ctx] (uri-for ctx]))]]]
)
No, what I’m trying to say (not so well) is that instad of the (fn [ctx] …) you should have a (yada/resource …) to use uri-for
I have been looking at yada and bidi for a while but not really gotten dirty with it yet, so could be very basic things I'm missing.
@kardan do you have an example that uses a yada resource for a response? All the examples I'm seeing are wrapping a map.
(def not-found
(resource
{:id :resource/not-found
:methods
{:get
{:produces "text/html"
:response (fn [ctx]
(str
"<html><body><p>"
"<a href='”(uri-for ctx :resources/home)”’>Home page</a>"
"</p></body></html>"))}}}))
I hope that works, I ripped it from a toy project and tried to remove as much cruft as possible
Hmm, my login route that has the yada.yada/uri-for
function is a resource right? That's the endpoint that throws the error.