Fork me on GitHub
#aleph
<
2017-08-31
>
genRaiy14:08:18

dumb question … how to use post with http client?

genRaiy14:08:19

I get a 401 when calling but it works when using curl / postman

genRaiy14:08:33

so I guess the body encoding is wrong in some way

genRaiy14:08:47

but help / tips welcome 🙂

genRaiy14:08:16

[ reading the http client code hasn’t helped ]

ehashman17:08:46

For one thing, your client id and client secret are not the same case

ehashman17:08:13

Does auth0 require basic auth? You haven't included any creds for that in the HTTP call

ehashman17:08:51

For basic auth, include {:basic-auth [username password]} in your options map to http/get

ehashman17:08:08

Or post in this case, I guess

genRaiy18:08:24

don’t worry about the parameters

genRaiy18:08:40

I just don’t know how to call POST with aleph

genRaiy18:08:32

this call (endpoint / body) works with the postman REST client

genRaiy18:08:47

so there is nothing wrong with the approach

ehashman19:08:56

What's the error you are getting? I'm not familiar with postman.

ehashman19:08:25

If it's just a 401, you have an authentication issue, which is why I asked if basic auth is requires

genRaiy19:08:57

ok, sorry to have been prickly … no basic auth needed

genRaiy19:08:20

it does use x-www-form-urlencoded

stijn19:08:27

@raymcdermott is it correct (like @ehashman pointed out) that your client-secret has a hyphen instead of underscore?

genRaiy19:08:13

maybe I’m being a dick

stijn19:08:02

okay 🙂

genRaiy19:08:23

nope, still 401

stijn19:08:46

I always use aleph.http/request with :method set to :post

stijn19:08:40

(aleph.http/request {:method :post :url "uuuuurrrlll"})

stijn19:08:15

can you paste the curl request?

genRaiy19:08:58

holy shit … case sensitive content-type

genRaiy19:08:03

it’s working now

genRaiy19:08:28

so do it the right way from now on @stijn 🙂

stijn19:08:29

that's a pretty awesome http response code in that case

genRaiy19:08:47

auth0 - yeah, the best

genRaiy19:08:28

so this is OK now

genRaiy19:08:22

@ehashman thanks for your support too

genRaiy21:08:36

hmmm … maybe not the content-type …. I tried it with Content-Type and it still worked

genRaiy21:08:54

so it’s working and thanks for your support

genRaiy21:08:12

probably was the - not being a _

ehashman21:08:04

I would agree :)