Release status: beta
|Implementation||User identity, Special page|
|Description||Provides login with your Google account.|
|Author(s)||Florian Schmidt (Florianschmidtwelzowtalk)|
|Latest version||see the version lifecycle|
Translate the GoogleLogin extension if it is available at translatewiki.net
|Check usage and version matrix.|
|Open tasks · Report a bug|
The GoogleLogin extension allows wiki users to login with their Google account. The extension uses the Google API to request basic profile information from Google (such as the account ID, the full name and the e-mail address).
- 1 Requirements
- 2 Installation
- 3 Configuration
- 3.1 Additional Configuration parameter
- 3.2 Settings in Google Developer Console
- 3.3 "Special:GoogleLoginReturn" or (in german for example) "Spezial:GoogleLoginReturn"
- 3.4 Debug
- 3.5 Use on a private wiki
- 3.6 Administer allowed domains on-wiki
- 3.7 Upgrade from 0.3.1 or older
- 4 Google API PHP Client
- 5 Version lifecycle
- 6 References
To use this extension you need at least:
- MediaWiki 1.27+
- MySQL (no PostgreSQL or SQLite support for now!)
- PHP 5.5+
- Google Developer Access
- Google+ API access
- API Credentials for Webapplication (Client ID and Client Secret)
- Able to run
composer update --no-dev
- Download and place the file(s) in a directory called
- Add the following code at the bottom of your LocalSettings.php:
- Run the update script which will automatically create the necessary database tables that this extension needs.
- Configure the required parameters
- Make sure ./wiki/extensions/GoogleLogin/cache is writeable for the Webserver's user
- Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
Note: Ensure that all settings reside under the "require_once" directive added for this plugin. Otherwise any custom settings will be overwritten by the default settings, as referenced here: Topic:Si6ituq6hmxb07xm
The extension provides two configuration variables to set the Client ID and Client Secret (you get this pair in the Google Developer Console, remove "<" and ">").
$wgGLSecret = '<your-client-secret>'; $wgGLAppId = '<your-client-id>';
Additional Configuration parameter
|Configuration variable||since version||Default value||Description|
|| An array of mail domains, which are allowed to use with GoogleLogin, e.g. |
||If set to true, GoogleLogin uses the database to check, if an e-mail domain of the primary e-mail-address of a Google account is allowed to login.|
|| Only observed, if |
test.example.com isn't allowed if
||Key for public API access. Used only for admin actions to check, if the user has a Google Plus profile or not.|
Settings in Google Developer Console
To use this extension you need a Google developer account and access to the developer console. This is a simple (a very simple!) step-by-step guide (use Step 1 of the official step-by-step example with these settings):
- Open Google developer console
- Read and accept the terms of service
- Create your first project
- Go to APIS & AUTH
- Go to APIs and enable Google+ API (read and accept the terms)
- Go to Credentials
- In Section OAuth click Create new Client ID
- Type in your Authorized redirect URI like this example:
- If your domain is example.com and you have installed MediaWiki in Root of your domain, the redirect URI is as follows: http://example.com/index.php/Special:GoogleLoginReturn
- Click create and copy the Client ID and Client Secret to the configuration variables in LocalSettings.php
"Special:GoogleLoginReturn" or (in german for example) "Spezial:GoogleLoginReturn"
The allowed redirect URI in Google developer console must be in the content language. So, if your wiki has german as the content language, then use
Spezial:GoogleLoginReturn. If you used the wrong language, all authentication requests will fail with the error code redirect uri mismatch.
Normally, you can see the error message on all generic error pages. Sometimes there are Internal Errors, called Exceptions. In this case, please add $wgShowExceptionDetails with value true in LocalSettings.php to see the complete Exception message. For a support request, please provide always the lines of the Exception.
Use on a private wiki
If you have set your Wiki to private with
$wgGroupPermissions['*']['read'] = false;
you have to whitelist the "Special:GoogleLoginReturn" page, so that anonymous users can access the callback URL after being redirected from the authentication provider. You can do this by adding the following line to your LocalSettings.php:
$wgWhitelistRead = array( 'Special:GoogleLoginReturn' );
Administer allowed domains on-wiki
GoogleLogin provides a feature to restrict the login with Google to specific E-Mail address domains (such as gmail.com, googlemail.com or every other (own) domain). This feature is especially interesting for companies, who use their own domain names with Google Apps. The list of domains, which are allowed to login with Google, are managed in an array in the LocalSettings.php (the
$wgGLAllowedDomains configuration option). Since version 0.4.0, GoogleLogin also provides a way to manage the list of allowed domains on the wiki itself. The allowed domains are saved in the database when this feature is enabled and can be change (remove/add) through a graphical user interface (a special page) or through the MediaWiki API.
Note: The list of allowed domains can not be managed in LocalSettings.php anymore, once the administration of the domains in the database is enabled.
To enable the feature to manage the allowed domains in the database, just set the
$wgGLAllowedDomainsDB configuration variable to
true in your LocalSettings.php. You also want to assign the new
managegooglelogindomains user right to one group you're a member of (please keep in mind, that all users with this user right are allowed to change the list of allowed domains, so consider to add this right to an administrator-level group only!). An example configuration could look like:
$wgGLSecret = 'your-secret'; $wgGLAppId = 'your-app-id'; $wgGLAllowedDomainsDB = true; $wgGroupPermissions['sysop']['managegooglelogindomains'] = true;
You now need to run the
update.php script again, so that the necessary database changes are applied to your database. After the update process is completed, you can navigate to the special page
Special:GoogleLoginAllowedDomains on your wiki. You'll get a page where you can add new domains, which are allowed to login with their Google account and you can remove them, once they was added.
Upgrade from 0.3.1 or older
With version 0.4.0, GoogleLogin implements a PrimaryAuthenticationProvider for the new authentication system of MediaWiki (called AuthManager). This makes it easier for the development of GoogleLogin and you can configure a lot more things in a standard way. However, upgrading from an older version of GoogleLogin may take some more time and effort as with upgrades in the past, as some configuration options in GoogleLogin were removed in the update (and mostly replaced by configurations of AuthManager). In the following sections you'll find some instructions about how you can configure your wiki to achieve the same goal as with the removed configuration options.
Removed without replacement.
Removed without replacement (the Keep me logged in checkbox now applies to all authentication methods, including GoogleLogin).
The whole account creation and login process is managed and covered by AuthManager. This means, if you don't want, that your users can create wiki accounts, you should disable it in your LocalSettings.php:
$wgGroupPermissions['*']['createaccount'] = false;
Currently, that would mean, that no one can create an account anymore (including GoogleLogin). There's also task T138678, which tracks the process of a login -> signup -> login workflow, where an account creation with a link provider (such as GoogleLogin) with a disabled account creation should be covered.
You should simply remove any other authentication provider in your LocalSettings.php:
$wgAuthManagerAutoConfig['primaryauth'] = ;
GoogleLogin will automatically setup itself for AuthManager, so you don't need to do any further steps.
Obsolete, see #$wgGLShowKeepLogin.
This configuration option still exists, but it's now used for more than just the Special:ManageGoogleLogin special page. It's now used to get the name of a user on Special:RemoveCredentials to make it easier to the user to identify the correct Google account (instead of just showing the Google ID). If the key isn't correct or isn't supplied, GoogleLogin will show the Google ID only. For a good user experience, it's highly suggested to supply this api key now.
Removed without replacement as the login and signup forms are now fully handled by AuthManager. If you still want to show the Login with Google at the right side of the login form, you should create a new extension (and probably share it with us ;)) which hooks into the form generation and accomplishes the form manipulation.
Removed without replacement.
Google API PHP Client
In the following table you'll find versions of the GoogleLogin extension, the corresponding MediaWiki version for which the GoogleLogin version was built for and if it's still supported (and until when) or not. Mostly the support of a version is nearly the same as the lifecycle of the corresponding MediaWiki version.
|Version||Corresponding MediaWiki version||Status||Release||End-of-life|
|0.4.x||1.28.x||current version||2016-06-18||November 2017|
|0.4.0||1.27.x (LTS)||current version||2016-07-20||June 2019|
|0.3.1||1.27.x (LTS)||obsolete (replaced by 0.4.0)||2016-06-10||2017-07-20|
|0.3.0||1.26.x||legacy version||n/a||November 2016|
Versions included in the above table that are marked as discontinued will not receive any fixes. They may contain critical security vulnerabilities and other major bugs, including the threat of possible data loss and/or corruption. The developer has also issued a strong recommendation that only versions listed above as current version or at least legacy version should be used in a production environment. Legacy versions will most likely get fixes for reported bugs that harms the core functionality of the extension, while current versions get fixes for most of the reported bugs (even if they're not part of the core functionality). New features will most likely be part of new versions. Backporting features to older versions of GoogleLogin is up to the developer(s).