Questions tagged [android-cookiemanager]

CookieManager is a public class in the Android API that manages the cookies used by an application's WebView instances. Cookies are manipulated according to RFC2109.

54 questions
1
vote
0 answers

Cordova Plugin to access WebKit CookieManager?

In my cordova project, I need to call Android's WebKit CookieManager.setAcceptCookie(false) in order to pass a security audit which flags the session cookie as plain text on the device. I've been able to proof this solution by editing the generated…
Stevko
  • 4,345
  • 6
  • 39
  • 66
1
vote
1 answer

Cannot resolve method setCookieHandler (java.net.CookieManger

I using CookieManger with okHttp and i don't know why its saying: Cannot resolve setCookieMethod. I googled its a valid method and the CookieManger and OkHttp is Imported in the project. OkHttpClient client = new OkHttpClient(); CookieManager…
Skyyy
  • 1,539
  • 2
  • 23
  • 60
1
vote
1 answer

Android Persistent Cookie Store with HTTPUrlConnection

I searched a lot now for the persistence of Cookies but cant find a good solution. I use HTTPUrlConnection to authenticate against a server and I get Cookies back. I retrieve them in CookieManager and can load them into a new connection. Now I want…
Rei
  • 11
  • 3
1
vote
1 answer

Android is ignoring cookies in my HTTP POST

My app does HTTP POSTS, in general the app works, but I am having trouble with the cookies. My code seems to get the cookies fine, through the HttpClient variable and out, but the results of the POST reveal that my app (as a client), is not…
Josh
  • 6,251
  • 2
  • 46
  • 73
1
vote
0 answers

Failed to invoke public android.webkit.CookieManager() with no args

I'm having this runtime exception when trying to do something like: token = new Gson().fromJson(new String(plainTextTokenBytes, HTTP.UTF_8), ACCESS_TOKEN_TYPE); Token type: ACCESS_TOKEN_TYPE = new TypeToken
1
vote
0 answers

CookieManger returns only one cookie (Android)

So I have a webView that loads mobile site... By default site sets first cookie: PHPSESSID... After login, I set UID cookie as well... But when I output cookie string, only first cookie is in the string... What am I missing? here is the code: …
pyelagin
  • 11
  • 1
1
vote
0 answers

cookiemanager.setcookie(domain,string) not working

I'm working on an android app. I'm able to receive cookies but cannot set to cookiemanager using cookiemanager.setcookie(url,string). When I check with cookiemanager.getcookies(url) I get null. I've tried answers in stack overflow but couldn't get…
1
vote
1 answer

Pass cookies from native login to webview

I am following this for sharing cookies from native code to WebView. I have a native login screen. On successful login I am saving the cookies in CookieSyncManager. And when the webview loads, I am passing those cookies to it so that the login…
Nitish
  • 13,845
  • 28
  • 135
  • 263
1
vote
2 answers

Android, how to get a cookie from URL via HttpClient()?

I have a login activity and I have to create a post request for my website to login the user into my mobile app. To create post requests on my website I need the csrf cookie as parameter, it means I have first to get the cookie from my URL and after…
Lara
  • 2,170
  • 6
  • 22
  • 43
1
vote
0 answers

Android Camera Intent destroys CookieManager session

For some reason, CookieManager sometimes loses the session variable when I open a camera intent and return from it. This doesn't happen all the time but it does happen often. I can confirm that the session variable is being lost because my backend…
1
vote
1 answer

CookieManager.removeExpiredCookie crashes on Android 4.1.2

The following code crashes with the included thread dump on Android 4.1.2 (on a Sprint Note II). CookieManager.getInstance().removeExpiredCookie() Dump: 12-12 13:45:35.484 1551-2908/com.example.myapp W/dalvikvm﹕ Invalid indirect reference…
Heath Borders
  • 30,998
  • 16
  • 147
  • 256
0
votes
0 answers

How to unit test function that references CookieManager?

The application in question has a logout function that among other things, performs a call to CookieManager.getInstance().removeAllCookies(null): fun logout(...) { …
0
votes
1 answer

Cookiemanager is returning different cookie parameters depending on the API

I am trying to get the cookie from an URL using CookieManager.getInstance().getCookie(url). What I have noticed is that for Android 10 the cookie contains __Host-nc_sameSiteCookielax=true; __Host-nc_sameSiteCookiestrict=true however for lower APIs…
MaxxOr
  • 55
  • 2
  • 6
0
votes
0 answers

Cookies injected in a cookie manager are not always accessible to web views

I have a class that observes a user account. It starts observing it when the app starts. When the account changes, it sets the cookie in a cookie manager with setCookie. When I start the app and the account is already there, it properly injects the…
0
votes
1 answer

Setting up cookie

try { CookieManager manager = new CookieManager(); CookieHandler.setDefault(manager); CookieStore cookieJar = manager.getCookieStore(); HttpCookie cookie = new HttpCookie("user", username); URL url = new…