Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3488958
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:20:05+00:00 2026-05-18T11:20:05+00:00

I want to fetch data from the webpage, that contains some json data. The

  • 0

I want to fetch data from the webpage, that contains some json data. The problem is, json data only returns if user is logged in on the website. If he is not, the login page is returned.

URL url = new URL(API_URL);
URLConnection conn = url.openConnection();

BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream)));
StringBuilder builder = new StringBuilder();
String line = "";

while ((line = br.readLine()) != null) {
    builder.append(line + System.getProperty("line.separator"));
}
String result = builder.toString();

So, in result I’m expecting to have json data. But I have a login page there. I tried logging in from the browser, but it did not help.

How do I use cookies from my browser to get through this login page?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T11:20:06+00:00Added an answer on May 18, 2026 at 11:20 am

    If you were using Java SE, I’d recommend that you use the Apache HttpClient library. This has support for various kinds of authentication, including form-based login with session cookies. I don’t know if this is a good recommendation for Android.

    EDIT

    I hadn’t noticed that the real issue was accessing the browser cookies.

    1: Have you tried using android.wewbkit.CookieManager.getInstance() or createInstance(Context) to get hold of the browser’s cookiemanager instance?

    2: Is it possible to write your application (or part of it) as a webkit plugin so that it can access the cookie that way? (I don’t know enough about webkit / android to know if this even makes sense.)

    3: If you cannot do that, you could conceivably write your application as a web proxy and have it “steal” the cookies as they come through. (This sounds like a bad idea though. There are security and privacy issues, as well as the issue that you could interfere with normal browser functionality.)

    4: Finally, there is the fallback option of writing your application to do its own login and manage its own session cookie. The snag is that you cannot avoid making your application specific to the remote website’s way of doing login.

    FOLLOWUP

    @Daniel Trebbien’s answer argues that option 1: is a not starter for security reasons. This makes sense. (If one app could get at another app’s cookies, browser security would be nonexistent.)

    While Android does provide a Plugin API, but it is deprecated and I’ve saw a posting from an Android engineer saying that its use is discouraged for 3rd party code. This pretty much makes option 2: a dead end.

    Option 3: would require the user to configure his phone’s Browser to use your app as a proxy … which they probably shouldn’t do.

    A couple of other options to consider are:

    5: Implement your application’s functionality in Javascript as a NPAPI Browser plugin.

    6: Use WebView to provide your application with its own (cut down) web browser. Your application will naturally have full access to its own CookieManager instance.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables that I want to fetch data from. Lets call them
I want to fetch some data from mySQL without refreshing the page using jQuery.
I want to fetch some data from the following database table 'article'. i want
My application often fetch data from a webpage using WebRequest, but it isn't possible
I want to fetch data from separate tables in sqlserver and display them together
I'm creating a application that will fetch data from an SQLite database and display
I want to fetch data from fox pro data base and insert it into
I want to fetch data from server side to my application which is in
I've got a situation which I want to fetch data from a database, and
I want to fetch data from database and show them in to android base

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.