Jump to content

How do I log in?


davidv7

Recommended Posts

I'm building an android APP. 

However, I keep getting unauthorized responses.

These are the URL's I'm trying with, since I do not know if you can log in any other way since there is no browser in my app.

1. http://username:password@IP:PORT/gui/token.html

This is supposed to get the cookie. 

conn.setRequestProperty("Connection", "keep-alive");
conn.setRequestProperty("Accept-Language", "ru,en-GB;q=0.8,en;q=0.6");
conn.setRequestProperty("Accept-Charset", "utf-8");
conn.setRequestProperty("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
conn.setRequestProperty("Cookie", "");

 

TThis works alright.  I get the cookie, it's not supposed to be authorized yet anyways. 

I call the first URL again, this time adding the cookie in request header. However this STILL returns unauthorized. Why does the url not log me in? I've checked, the Username and Password are correct, so is the IP and PORT.

connection.setRequestProperty("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/*;q=0.8");

connection.setRequestProperty("Accept-Encoding", "gzip, deflate, lzma, sdch");
connection.setRequestProperty("Accept-Language", "ru,en-GB;q=0.8,en;q=0.6");
//
//connection.setRequestProperty("Accept-Charset", "utf-8");
connection.setRequestProperty("Cookie", cookie);
connection.setRequestProperty("Referer", "http://192.168.1.4:8080/gui/token.html");
connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.59 Safari/537.36 OPR/41.0.2353.46");

 

So far I've gotten 0 responses from StackOverflow and every question I've asked here so far has been ignored. Does  no one have the answer? You can't even access the API without logging in first. 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...