Hello,

AFAIK the parameters for the action 'clientlogin' are 'lgname' and
'lgpassword' and not 'username' and 'password'.

See the documentation:
https://www.mediawiki.org/wiki/API:Login

Anyway, hoping to be useful, here you are a little framework to
simplify that part:
https://github.com/valerio-bozzolan/boz-mw

In that way, can be just:

$wiki = \wm\MetaWiki.php::instance();
$wiki->login( $user, $password );
if( $wiki->isLogged() ) {
    echo "OK";
}

By!

On Tue, 2019-05-28 at 17:34 -0400, Daniel Edery wrote:
> Hello,
> I've been trying to have my user remotely sign-in through my
> laravel/react site, but I've been reaching a dead-end.
> After reading this post from 2017 : https://laracasts.com/discuss/cha
> nnels/general-discussion/single-sign-on-mechanism-for-laravel-and-
> mediawiki?page=0
> I've followed the step for method 2 from: https://www.mediawiki.org/w
> iki/API:Login
> I've request a login token with the api with a "GET" call of
> "/api.php?action=query&format=json&meta=tokens&type=login"
> and received for example: 
> "97b2edb716fa7b13f2955c79e7f8f0205ceda2c6+\\"
> Then I "POST" the result with the formData provided: (I am 100% sure
> those credentials are valid as I can use them to login)
> action:   clientlogin
> username:   TestUser
> password: ********
> loginrequests: 
> loginmessageformat:   wikitext
> loginreturnurl:   http://localhost:3000/
> logintoken:   f90d08a1b279a521d24a4f629b678bb35ceda63d+\
> format:   json
> The response that I get back is:
> {"warnings":{"main":{"*": "Unrecognized parameters: username,
> password."}},"clientlogin":{"status": "FAIL","message": "The supplied
> credentials could not be authenticated.","messagecode": "authmanager-
> authn-no-primary"}}
> What am I missing to correctly remote login a user?
> Any help would be appreciated.
> Daniel
> 
> _______________________________________________
> Mediawiki-api mailing list
> Mediawiki-api@lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
-- 
[[User:Valerio Bozzolan]]

E-mail sent using Evolution in Debian GNU/Linux without proprietary
software.

Have fun with software freedom!

_______________________________________________
Mediawiki-api mailing list
Mediawiki-api@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api

Reply via email to