Can't create dir using HUE REST API, it redirects me back to login page

13 views
Skip to first unread message

capac...@gmail.com

unread,
May 30, 2020, 7:12:30 AM5/30/20
to Hue-Users
Hi there,
I'm desperately trying to create dir in HDFS using  HUE REST API.
Yes, I know it's private and can be broken in the future. I'm fine with it.
I can login to hue using REST API
Here is Hue runcpserver.log output:


[30/May/2020 04:06:07 -0700] decorators   INFO     AXES: Calling decorated function: dt_login

[30/May/2020 04:06:07 -0700] decorators   INFO     AXES: Calling decorated function: dt_login

[30/May/2020 04:06:07 -0700] access       WARNING  172.17.0.1 cloudera - "POST /accounts/login/ HTTP/1.1" -- Successful login for user: cloudera

[30/May/2020 04:06:08 -0700] middleware   INFO     Redirecting to login page: /filebrowser/mkdir?next=/filebrowser/view=/user/cloudera

[30/May/2020 04:06:08 -0700] access       INFO     172.17.0.1 -anon- - "POST /filebrowser/mkdir HTTP/1.1" -- login redirection

[30/May/2020 04:06:11 -0700] access       INFO     172.17.0.1 cloudera - "GET /jobbrowser/ HTTP/1.1"



Why does it redirect me to login?
Here is my code

val accessToken = login()
val req = Http(s"$baseUrl/filebrowser/mkdir?next=/filebrowser/view=$hdfsPathDirParent")
.postMulti()
.params(
Seq("name" -> hdfsDirName,
"path" -> hdfsPathDirParent,
"csrfmiddlewaretoken" -> accessToken.csrftoken
))
.cookie("csrftoken", accessToken.csrftoken)
.cookie("sessionid", accessToken.sessionid)
.headers(accessToken.headersMap)

I do pass:
- cookie with csrftoken
- cookie with sessionid
- csrfmiddlewaretoken post param is set


What else does HUE need from me? 

capac...@gmail.com

unread,
May 30, 2020, 8:09:08 AM5/30/20
to Hue-Users, capac...@gmail.com
https://archive.cloudera.com/cdh5/cdh/5/hue/sdk/sdk.html#rest
this one doesn't work too.


суббота, 30 мая 2020 г., 13:12:30 UTC+2 пользователь capac...@gmail.com написал:
Reply all
Reply to author
Forward
0 new messages