Suddenly cannot login to the Api

Has been working fine for the lat 2-3days since I started working with it. I am able to login to the website and I even did a password change and can still login to th site but not the api.

Tell me more, is this a custom oauth app you’re developing? What error do you see? What’s your username?

I’m making a ton of changes right now because it’s the weekend, so it’s entirely possible I borked something!

Its a custom app but i’m only on like a week of dev so based on what I read I was just using the cookie. I’m happy to swtich to the oauth if that’s preferable?

username is: timcadieux

all I get when I do api calls is

ā€œ{ā€œunread_feed_story_hashesā€: {}, ā€œresultā€: ā€œokā€, ā€œauthenticatedā€: false}ā€

Hoppscotch returns

{
ā€œcodeā€: -1,
ā€œerrorsā€: {
ā€œusernameā€: [
ā€œPlease enter a username.ā€
]
},
ā€œresultā€: ā€œokā€,
ā€œauthenticatedā€: false
}

Nothing’s broken on the server side - your API login is actually succeeding in the logs. Two issues:

1. In Hoppscotch, make sure you’re sending the login as application/x-www-form-urlencoded form data (not JSON). The ā€œPlease enter a usernameā€ error means the POST body isn’t being parsed correctly.

2. After login, you need to store and send the session cookie (newsblur_sessionid) with every subsequent request. That’s why you’re getting authenticated: false on other endpoints. With curl: curl -c cookies.txt -X POST -d ā€˜username=…&password=…’ https://newsblur.com/api/login then curl -b cookies.txt https://newsblur.com/reader/feeds.

1 Like

Hmm, sounds like I borked something on my side instead becuase that is how I had been working.

I’ll give Hoppscotch another go as I’m looking at it and i am using application/x-www-form-urlencoded

There was a trailing comma, argh…

Thanks!