Hello everyone!
I noticed that some people is seeing this warning in various occasions:
Fetching a token via "action=login" is deprecated. Use "action=query&meta=tokens&type=login" instead.
See for example:
- T126577: Cannot login to AutoWikiBrowser: "Fetching a token via action=login is deprecated. Use action=query&meta=tokens&type=login instead."
- T228052: Fetching a token via "action=login" is deprecated. Use "action=query&meta=tokens&type=login" instead
- T159523: PWB cannot handle bot tokens returned from action=login
The problem about this warning, is that it's quite misleading when it's actually raised during this API query:
action=login lgname=ItwikiBot@mark_admins lgpassword=a_very_long_bot_password lgtoken=a_token_obtained_from_api_token_ending_with_+\
With the username and password generated from [[Special:BotPasswords]].
If it can help, note that the token was obtained with such request:
action=query meta=tokens type=login
Now, I've also seen a discussion in T137805: API action=login is deprecated and it seems that some developers already know that this warning is raised in some circumstances:
That's an unrelated warning.
― @Anomie in T137805#2786123 - Nov 10 2016, 5:19 PM
So. Why action=login gives a warning about Fetching a token when you are already providing that token and anyway when the API call is not deprecated?
This is even more confusing, because AFAIK action=login is only deprecated for main account login and not for the bot passwords authentication.
P.S.
I forgot to say that this happens when the login fails and the server replies with:
{"login":{ "result":"NeedToken", "token":"that-token+\" }
Anyway the bot password is correct.