Expand all

mediawiki.authenticationPopup

Exposes an instance of AuthPopup configured to display a login dialog for the local instance of MediaWiki.

The promises returned by AuthPopup methods will be resolved with a userinfo object.

This library is not stable yet (as of May 2024). We're still testing which of the methods work from the technical side, and which methods are understandable for users. Some methods or the whole library may be removed in the future.

Examples

const authPopup = require( 'mediawiki.authenticationPopup' );
authPopup.startPopupWindow()
// or: authPopup.startNewTabOrWindow()
// or: authPopup.startIframe()
    .then( function ( userinfo ) {
        if ( userinfo ) {
            // Logged in
            console.log( userinfo.name );
        } else {
            // Cancelled by the user
        }
    }, function ( error ) {
        // Unexpected error stopped the login process
    } );

Example using `await` syntax

const userinfo = await authPopup.startPopupWindow(); // etc.
if ( userinfo ) {
    // Logged in
} else {
    // Cancelled by the user
}
Source:

Type Definitions

userinfo #

userinfo object as returned by the action=query&meta=userinfo API module.

Type:

Properties:

Name Type Description
name string
id number
Source:

userinfo object as returned by the action=query&meta=userinfo API module.