Hi, all! Does anyone know how to use JavaNetCookie...
# squarelibraries
a
Hi, all! Does anyone know how to use JavaNetCookieJar to collect cookies from multiple redirects? I’ll post more info in a thread below.
I’m sending a GET request to a url which undergoes three 302 redirects. Doing it by curl I get: Request -> 302 Moved Temporarily (Set-Cookie: name=some_cookie*;* Path=/; SameSite=Lax; Secure; HttpOnly) -> 302 Found (Set-Cookie: name1=some_cookie_1*;* Path=/; Secure; HttpOnly, Set-Cookie: name2=some_cookie_2*;* Path=/; Secure; HttpOnly ) Cookie: name=some_cookie -> 302 Moved Temporarily (Set-Cookie: name=some_huge_cookie; Path=/; SameSite=Lax; Secure; HttpOnly) -> 200 with correct json
But when I’m performing the same request with retrofit + okhttpclient + JavaNetCookieJar from android application, I’m getting 401 and Cookies are really small. The interesting part is that the very start of these cookies look kinda the same as the start of the first cookies of the request chain. But I can’t figure out that happens with the rest of them.
Theoretically speaking, I could apply
followSslRedirects(false)
and perform redirects manually. This approach seems a little off though. And I wonder is there a well-known one that I don’t know of?)
j
could ya turn on the logging interceptor and paste the headers?
might be something exotic in the domain names or something
a
Hi. Unfortunately, headers contain some NDA, so I can’t post them here(
They are x-proxy and server
But you gave me a great idea to look closely at my headers again and I found missing type for redirects in Accept header. Thank you :)
👍🏻 1