Extension:AuthManagerOAuth

From mediawiki.org
MediaWiki extensions manual
AuthManagerOAuth
Release status: beta
Implementation User identity
Description Create accounts or login using OAuth
Author(s) Moritz Hedtke (Dev.mohetalk)
Latest version 0.3.2 (2023-11-18)
Compatibility policy Main branch maintains backward compatibility.
MediaWiki 1.35.0+
PHP 7.4+
Database changes Yes
Tables authmanageroauth_linked_accounts
License GNU General Public License 2.0 or later
Download
Changelog
$wgAuthManagerOAuthConfig

The AuthManagerOAuth extension allows to create accounts or login using OAuth.

Installation[edit]

  • Download and place the file(s) in a directory called AuthManagerOAuth in your extensions/ folder.
  • Only when installing from Git, run Composer to install PHP dependencies, by issuing composer install --no-dev in the extension directory. (See task T173141 for potential complications.)
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'AuthManagerOAuth' );
    
  • Run the update script which will automatically create the necessary database tables that this extension needs.
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Configuration parameters[edit]

$wgAuthManagerOAuthConfig = [
    'github' => [
        'clientId'                => 'xxx',
        'clientSecret'            => 'xxx',
        'urlAuthorize'            => 'https://github.com/login/oauth/authorize',
        'urlAccessToken'          => 'https://github.com/login/oauth/access_token',
        'urlResourceOwnerDetails' => 'https://api.github.com/user'
    ],
    'google' => [
        // ...
    ]
];

The values in this keyed array have to conform to the parameter of the GenericProvider constructor at https://oauth2-client.thephpleague.com/usage/. The key cannot be changed afterwards as it's used in the database for storing the linked accounts.