Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to store cookies, and reuse them in another session
    text
    copied!<p>I am trying to authenticate a user from a web page, store the cookies and load an rss-feed from a different web page as the authenticated user.</p> <p>Im using a webView with this WebViewClient which loads an RSS-link when the user has authenticated himself (url is finished loading): - This does not redirect until after user logs in and presses another link.. How can I redirect straight after login?</p> <pre><code>class LinkWebViewClient extends WebViewClient { //Callback method for when the url is finished loading @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); view.loadUrl("https://something.com/todays-rssfeeds"); return true; } @Override public void onPageFinished(WebView view, String url) { CookieSyncManager.getInstance().sync(); }; } </code></pre> <p>Main Problem is when i try to load the second page, i have to re-authenticate myself because it is not the same session..</p> <p>Any suggestions to how i can solve these problems?</p> <p>These are my Cookie settings:</p> <p>/</p> <pre><code>/ use cookies to remember a logged in status CookieSyncManager.createInstance(this); CookieManager cookieManager = CookieManager.getInstance(); //After Login List&lt;Cookie&gt; cookies = httpClient.getCookieStore().getCookies(); if (!cookies.isEmpty()) { for (int i = 0; i &lt; cookies.size(); i++) { cookie = cookies.get(i); } } Cookie sessionCookie = cookie; if(sessionCookie != null) { String cookieString = sessionCookie.getName() +"="+sessionCookie.getValue()+"; domain="+sessionCookie.getDomain(); cookieManager.setCookie(myUrl, cookieString); CookieSyncManager.getInstance().sync(); } </code></pre> <p>All help appreciated! Thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload