Yesterday I started to get "Please enter a username" back as an error when posting username=USERNAME&password=PASSWORD to use /api/login per https://www.newsblur.com/api#/api/login. I'm using an actual account of course. Similar, if not the same, code was working a few days back. Anyone other programmers seeing this?
Samuel Clay, Official Rep
- 5250 Posts
- 1171 Reply Likes
I upgraded to the latest Django, which changed some things. However, I checked and it should be working fine. Are you making a POST request? It would tell you if you weren't, but I'm not sure what's going on then.
Thanks for the fast response Samuel. Yes, I am doing a POST request with httplib2 (python). The scrubbed data I am POSTING via httplib2 is:
urllib.urlencode({'username': 'USERNAMEHERE', 'password': 'PASSWORDHERE'})
I'm away from my personal dev machine right now but I'll take a look and triple check my script to verify and will get back with you.
urllib.urlencode({'username': 'USERNAMEHERE', 'password': 'PASSWORDHERE'})
I'm away from my personal dev machine right now but I'll take a look and triple check my script to verify and will get back with you.
Edit: Changed from code to pre tag
Tried it again this am and it's still giving me the username result. Here is the sample code (just in case I'm misreading something):
The body result I see is:
Tried it again this am and it's still giving me the username result. Here is the sample code (just in case I'm misreading something):
import httplib2
import json
import urllib
class NewsBlur(object):
def __init__(self, username, password, endpoint='https://www.newsblur.com'):
self.username = username
self.baseurl = endpoint
self.http = httplib2.Http()
creds = urllib.urlencode(
{'username': self.username, 'password': password})
print creds # To verify what is being posted
head, body = self.http.request(self.baseurl + '/api/login', 'POST', creds)
print head, body # Results
nb = NewsBlur('MYUSERNAME', 'MYPASSWORD')
The body result I see is:
{"code": -1, "authenticated": false, "errors": {"username": ["Please enter a username."]}, "result": "ok"}
- 1 Post
- 0 Reply Likes
others are impacted, like the Feed Me app on Windows Phone. I'm a user of the app, and I can't login with it to my NewsBlur account.
http://www.wpcentral.com/newsblur-alt...
http://www.wpcentral.com/newsblur-alt...
What version of Django were you using before -- and what is in use now? Maybe I can set up a local instance and test to see if the Django upgrade caused it.
- 2 Posts
- 0 Reply Likes
when i login with my account succesfully, response does not return me a cookie.
so any next webrequest is anonymous. can you help me please?
my csharpcode is :
RestClient client = new RestClient("http://www.newsblur.com");
RestRequest login = new RestRequest("/api/login", Method.POST);
login.AddParameter("username", "xxxxxxxxxxxxxxxxxxx");
IRestResponse response = client.Execute(login);
CookieContainer cookiecon = new CookieContainer();
if (response.StatusCode == HttpStatusCode.OK)
{
var cookie = response.Cookies.FirstOrDefault();
cookiecon.Add(new Cookie(cookie.Name, cookie.Value, cookie.Path, Cookie.Domain));
}
client.CookieContainer = cookiecon;
RestRequest feeds = new RestRequest("/reader/feeds", Method.GET);
IRestResponse response = client.Execute(login);
so any next webrequest is anonymous. can you help me please?
my csharpcode is :
RestClient client = new RestClient("http://www.newsblur.com");
RestRequest login = new RestRequest("/api/login", Method.POST);
login.AddParameter("username", "xxxxxxxxxxxxxxxxxxx");
IRestResponse response = client.Execute(login);
CookieContainer cookiecon = new CookieContainer();
if (response.StatusCode == HttpStatusCode.OK)
{
var cookie = response.Cookies.FirstOrDefault();
cookiecon.Add(new Cookie(cookie.Name, cookie.Value, cookie.Path, Cookie.Domain));
}
client.CookieContainer = cookiecon;
RestRequest feeds = new RestRequest("/reader/feeds", Method.GET);
IRestResponse response = client.Execute(login);
Samuel Clay, Official Rep
- 5250 Posts
- 1171 Reply Likes
The cookie's name is newsblur_sessionid. What's the response look like? It needs to say 'authenticated': true.
- 2 Posts
- 0 Reply Likes
Sam
you wake me up and finally it was easy.
my call (added password):
RestClient client = new RestClient("http://www.newsblur.com");
RestRequest login = new RestRequest("/api/login", Method.POST);
login.AddParameter("username", "xxxxxxxxxxxxxxxx");
login.AddParameter("password", "xxxxxxxxxxxxxxxxxxx");
IRestResponse response = client.Execute(login);
response :
{"code": 1, "authenticated": true, "errors": null, "result": "ok"}
thank you!
you wake me up and finally it was easy.
my call (added password):
RestClient client = new RestClient("http://www.newsblur.com");
RestRequest login = new RestRequest("/api/login", Method.POST);
login.AddParameter("username", "xxxxxxxxxxxxxxxx");
login.AddParameter("password", "xxxxxxxxxxxxxxxxxxx");
IRestResponse response = client.Execute(login);
response :
{"code": 1, "authenticated": true, "errors": null, "result": "ok"}
thank you!
Related Conversations
Can't login via the API
- rtopitt, 2 years ago
- Last reply: Andrew Mittereder, 2 years ago
- 1
- 4
- Problem
/api/login is returning a 502 message
- var = DivisiveCotton, 11 months ago
- Last reply: Samuel Clay, 11 months ago
- 1
- 1
- Question
Login Method on API does not return Premium status of user
- Andrew Elliott, 2 years ago
- 2
- 0
- Problem
API: How to login and execute Commands?
- bnewsblur, 6 months ago
- Last reply: Josh Sled, 6 months ago
- 1
- 1
- Question
Related Categories
-
NewsBlur.com
- 2634 Conversations
- 41 Followers




