Topic on Project:Support desk

Readapidenied after clientlogin status PASS on private wiki

6
ErikWG (talkcontribs)

Hi!

I successfully managed to use the clientlogin api to login and get a status of "PASS". The http library I use correctly handles cookies and headers.

However, when I do either of the following requests after having received the PASS on clientlogin:


...api.php?action=parse&page=lol&format=json

or

...?action=query&assert=user&format=json


I get a readapidenied error.

I only get this error when I'm trying to GET from my code. If I open a browser and login manually and then type the queries manually as well, I get a correct response. Any ideas as to why this is?

Ciencia Al Poder (talkcontribs)

This clearly indicates the http library you're using doesn't handle cookies well, or you're not telling that library to handle them.

ErikWG (talkcontribs)

Well, the thing is that I can GET logintoken and use it and the set cookies/headers to login with a successful PASS, but I still get the readapidenied when I try to do any other api calls.

The wiki in question is https://fwiki.se/ with api located at https://fwiki.se/api.php


Ciencia Al Poder (talkcontribs)

You'll have to debug the client library you use to make it print all headers, and see if it actually sends the cookies it receives from the login.

The api works fine since you said from your browser being logged in you don't get the error.

200.56.63.155 (talkcontribs)

@ErikWG how do you fixed the error readapidenied.

89.253.82.151 (talkcontribs)

I simply used a different HTTP package for better management of cookies. Cookie and header-handling turned out to be my problem.