Topic on Extension talk:GoogleLogin

Szabep (talkcontribs)

Set up Google Login extension. After click on Sign in with Google button:


[XpMvl@LAlRhgyItn9wkGkwAAAM4] /index.php?title=Speci%C3%A1lis:Bel%C3%A9p%C3%A9s&returnto=Kezd%C5%91lap Error from line 27 of /home/ezernegyes/public_html/wiki/extensions/GoogleLogin/includes/GoogleLogin.php: Class 'Google_Client' not found

Backtrace:

#0 /home/ezernegyes/public_html/wiki/extensions/GoogleLogin/includes/Auth/GooglePrimaryAuthenticationProvider.php(393): GoogleLogin\GoogleLogin::getClient(string, string)

#1 /home/ezernegyes/public_html/wiki/extensions/GoogleLogin/includes/Auth/GooglePrimaryAuthenticationProvider.php(373): GoogleLogin\Auth\GooglePrimaryAuthenticationProvider->getGoogleClient()

#2 /home/ezernegyes/public_html/wiki/extensions/GoogleLogin/includes/Auth/GooglePrimaryAuthenticationProvider.php(41): GoogleLogin\Auth\GooglePrimaryAuthenticationProvider->beginGoogleAuthentication(array, string)

#3 /home/ezernegyes/public_html/wiki/includes/auth/AuthManager.php(458): GoogleLogin\Auth\GooglePrimaryAuthenticationProvider->beginPrimaryAuthentication(array)

#4 /home/ezernegyes/public_html/wiki/includes/auth/AuthManager.php(388): MediaWiki\Auth\AuthManager->continueAuthentication(array)

#5 /home/ezernegyes/public_html/wiki/includes/specialpage/AuthManagerSpecialPage.php(354): MediaWiki\Auth\AuthManager->beginAuthentication(array, string)

#6 /home/ezernegyes/public_html/wiki/includes/specialpage/AuthManagerSpecialPage.php(484): AuthManagerSpecialPage->performAuthenticationStep(string, array)

#7 /home/ezernegyes/public_html/wiki/includes/htmlform/HTMLForm.php(690): AuthManagerSpecialPage->handleFormSubmit(array, VFormHTMLForm)

#8 /home/ezernegyes/public_html/wiki/includes/specialpage/AuthManagerSpecialPage.php(417): HTMLForm->trySubmit()

#9 /home/ezernegyes/public_html/wiki/includes/specialpage/LoginSignupSpecialPage.php(313): AuthManagerSpecialPage->trySubmit()

#10 /home/ezernegyes/public_html/wiki/includes/specialpage/SpecialPage.php(575): LoginSignupSpecialPage->execute(NULL)

#11 /home/ezernegyes/public_html/wiki/includes/specialpage/SpecialPageFactory.php(611): SpecialPage->run(NULL)

#12 /home/ezernegyes/public_html/wiki/includes/MediaWiki.php(296): MediaWiki\Special\SpecialPageFactory->executePath(Title, RequestContext)

#13 /home/ezernegyes/public_html/wiki/includes/MediaWiki.php(900): MediaWiki->performRequest()

#14 /home/ezernegyes/public_html/wiki/includes/MediaWiki.php(527): MediaWiki->main()

#15 /home/ezernegyes/public_html/wiki/index.php(44): MediaWiki->run()

#16 {main}

Florianschmidtwelzow (talkcontribs)

Did you run `composer update` in the extension folder (or in your mediawiki installation when using the composer merge plugin)? It seems you've not :)

97.120.122.216 (talkcontribs)

@Florianschmidtwelzow Thanks for this, I'm having the same issue. The instructions said "Only when installing from git run Composer" whereas I did not install from git. I tried anyway and got the error "composer: command not found". I'll go ahead and try to install Composer onto MediaWiki now... am I on the right track?

Florianschmidtwelzow (talkcontribs)

Yeah, you're on the right track. If you don't have a vendor folder in your GoogleLogin extension folder, then you need to run composer install (given that you're not using the composer merge plugin, which you would know, if you would use it :P).

97.120.122.216 (talkcontribs)

@Florianschmidtwelzow thanks! Unfortunately my attempt crashed my wiki.

I did a full restore to backup for my site and database, but sadly it is still down.

Here's the fatal error:

Warning: require(home/me/mysite.com/wiki/includes/libs/objectcache/EmptyBagOStuff.php): failed to open stream: No such file or directory in /home/me/mysite/wiki/includes/AutoLoader.php on line 109 Fatal error: require(): Failed opening required '/home/me/mysite/wiki/includes/libs/objectcache/EmptyBagOStuff.php' (include_path='/home/me/mysite/wiki/vendor/pear/console_getopt……… and so on

Here's the commands I performed before it crashed:

  1. within /wiki/maintenance I ran the update script - "php update.php"
  2. within /wiki/ I installed composer with the four commands in getcomposer.com/download
  3. within /wiki/ I performed "php composer.phar update" (this was by accident, I meant to switch to the GoogleLogin folder first)
  4. within /wiki/extensions/GoogleLogin I performed "php /home/me/mysite/wiki/composer.phar update --no-dev"

Any chance you can see why my site is still having a fatal error, despite restoring to backup?

Florianschmidtwelzow (talkcontribs)

That doesn't look, in any way, related to what you did. The error/warning shown above indicates, that your MediaWiki installation is missing some files. Did you try to copy over the MediaWiki files from a fresh copy of MediaWiki?

97.120.122.216 (talkcontribs)

You're right, my restore was missing a few files and folders for some reason. I just re-uploaded them and it was fine.

Anyhoo, I realized that the basic issue that crashed my wiki was authoritative mode:

> ConfigurationError: GoogleLogin runs in authoritative mode, but multiple primary authentication providers where found.

To get around this, I had to add the $wgAuthManagerConfig settings from another user below.

Once I did that, it worked great!

Here was my final LocalSettings.php configuration:

wfLoadExtension( 'GoogleLogin' );

$wgGLSecret = ‘’;

$wgGLAppId = ‘-.apps.googleusercontent.com';

$wgGLAllowedDomains = array( ‘mygsuiteaccount.com’ );

$wgGLAuthoritativeMode = true;

$wgUserrightsInterwikiDelimiter = "%";

$wgInvalidUsernameCharacters = "%:";

$wgGroupPermissions['*']['autocreateaccount'] = true;

$wgGLAllowedDomainsStrict = true;

$wgAuthManagerConfig = [

'primaryauth' => [

GoogleLogin\Auth\GooglePrimaryAuthenticationProvider::class => [

"class" => GoogleLogin\Auth\GooglePrimaryAuthenticationProvider::class,

"sort" => 0 ]

],

'preauth' => [],

'secondaryauth' => [],

];

And here was my full list of steps that it took me, in case it helps anyone else:

1. Download and drop GoogleLogin into Extension folder

2. Set up Google APIs project ClientID + Secret (make sure URI is correct)

3. Configure LocalSettings.php as above, with ClientID+Secret+domain added in

4. ssh into site, cd to mysite/wiki/extensions/GoogleLogin/

5. Get composer.phar: wget getcomposer.org/composer.phar

6. Run composer in GoogleLogin folder: php composer.phar install --no-dev

7. cd to GoogleLogin/maintenance/ and run php updatePublicSuffixArray.php

8. cd to mysite/wiki/maintenance and run php update.php


@Florianschmidtwelzow Thanks for all the help! Quick question: You alluded to removing $wgAuthManagerConfig section, but I'm guessing that isn't possible if you're in authoritative mode? At least for me it caused the fatal error above.

Florianschmidtwelzow (talkcontribs)

If you want to run in authoritative mode, you need to ensure that GoogleLogin is the only available primary authentication provider. This is only possible if you manually set the $wgAuthManagerConfig configuration, not by relying on the auto-configuration. So, no, you can not remove the config ;)

97.120.122.216 (talkcontribs)

Good to know, thanks! :)