Fork me on GitHub
#yada
<
2017-09-28
>
ThadIsNOTFood06:09:42

okay I am totally lost. I have from Google

clientId:""
code:"yyy"
redirectUri:""
state:"zzzz"
what do I do with it now?

dominicm06:09:16

Pro tip, yada has oauth support (which probably works with Google)

ThadIsNOTFood06:09:39

yeah the documents are a bit sparse in that area 😞

dominicm06:09:39

A little bit of reading the source, you set the authentication scheme to oauth, and the options are specified in that function (kinda)

dominicm06:09:31

There's even an Google oauth 2 callback resource for use

ThadIsNOTFood06:09:57

yeah, I'm really feeling this is much simpler than I am making it out to be. I'm sure I am over thinking it.

ThadIsNOTFood06:09:25

["/auth/google" (yada/as-resource oauth/oauth2-callback-resource-google)]?

dominicm06:09:35

The Google resource is a function which returns a resorted

ThadIsNOTFood06:09:57

["/auth/google" (oauth/oauth2-callback-resource-google :response)]?

dominicm06:09:13

It needs these options in a map: :access-token-url s/Str :client-id s/Str :client-secret s/Str :secret s/Str :redirect-uri s/Keyword ;; The function that will ultimately call the third-party API for user-details. ;; First argument is the access-token :handler (s/=> {s/Any s/Any} {:access-token s/Str :openid-claims {s/Str s/Str}})

macroz08:09:19

I'm trying to get header parameters to work with yada. One thing is that they seem to be case insensitive. The other is that if I declare a header parameter such as

{:parameters {:header {:foo String}}}
Then no matter if I provide foo or not I get various error messages saying that it is missing. Perhaps I'm doing something wrong. This makes no difference either.
{:parameters {:header {"foo" String}}}

macroz08:09:10

the error is a variation of

{:status 400,
 :errors ([:header {:error {:foo missing-required-key}}])}
and
More than one non-optional/required key schemata: ["foo" java.lang.String]

macroz08:09:18

this is not covered in detail in the docs

danielcompton08:09:25

@macroz this caught me too

danielcompton08:09:29

what you need is

danielcompton08:09:40

{:header {(schema/required-key "x-orig-url") String}}

danielcompton08:09:03

np, happy to help

macroz09:09:46

Is the best practice to match both /foos and /foos/ to use #{"" "/"}

macroz09:09:14

that seems like a very common thing to have to do and it clutters my routes a bit

borkdude15:09:02

I’m trying out our yada app on clojure 1.9.0-beta1. I get an exception on aleph/http/multipart.clj line 30

malcolmsparks15:09:13

@borkdude thanks for reporting

borkdude15:09:38

Upgrading aleph to the newest stable solves it