Topic on Extension talk:GoogleLogin

GooglePrimaryAuthenticationProvider not found

3
Summary by Florianschmidtwelzow

Missing use/import of GoogleLoginPrimaryAuthenticationProvider class.

144.208.212.18 (talkcontribs)

Hi,


I am running MediaWiki 1.33 with docker. When adding GooglePrimaryAuthenticationProvider as my primary provider to enable account creation, I get the error:


Fatal error: Uncaught Error: Class 'GooglePrimaryAuthenticationProvider' not found in /var/www/html/vendor/wikimedia/object-factory/src/ObjectFactory.php:77 Stack trace: #0 /var/www/html/includes/auth/AuthManager.php(2311): Wikimedia\ObjectFactory::getObjectFromSpec(Array) #1 /var/www/html/includes/auth/AuthManager.php(2364): MediaWiki\Auth\AuthManager->providerArrayFromSpecs('MediaWiki\\Auth\\...', Array) #2 /var/www/html/includes/auth/AuthManager.php(922): MediaWiki\Auth\AuthManager->getPrimaryAuthenticationProviders() #3 /var/www/html/includes/skins/SkinTemplate.php(705): MediaWiki\Auth\AuthManager->canCreateAccounts() #4 /var/www/html/includes/skins/SkinTemplate.php(463): SkinTemplate->buildPersonalUrls() #5 /var/www/html/includes/skins/SkinTemplate.php(228): SkinTemplate->prepareQuickTemplate() #6 /var/www/html/includes/OutputPage.php(2723): SkinTemplate->outputPage() #7 /var/www/html/includes/exception/MWExceptionRenderer.php(134): OutputPage->output() #8 /var/www/html/includes/exception/MWExceptionRenderer.php(53): in /var/www/html/vendor/wikimedia/object-factory/src/ObjectFactory.php on line 77

I am using the latest code from your git I guess and install the extension that way:

From mediawiki:latest

RUN git clone --depth 1 -b master \

      https://gerrit.wikimedia.org/r/p/mediawiki/extensions/GoogleLogin \

      /var/www/html/extensions/GoogleLogin

RUN cd /var/www/html/extensions/GoogleLogin/ && composer install --no-dev


I can see the GooglePrimaryAuthenticationProvider file in includes/Auth.


In my LocalConfig I have set


$wgAuthManagerConfig = [

 'primaryauth' => [
   GooglePrimaryAuthenticationProvider::class => [
     "class" => GooglePrimaryAuthenticationProvider::class,
     "sort" => 0
   ]
 ],
 'preauth' => [],
 'secondaryauth' => [],

];


Thanks!

Florianschmidtwelzow (talkcontribs)

Hi! Thanks for posting here :) First of all, this looks like you missed something. The GoogleLogin Code is actually part of a namespace (GoogleLogin\Auth), so you can not simply use GooglePrimaryAuthenticationProvider::class without specifying it with a fully-qualified namespace, or importing it. So, in your case, it should be enough to add the following line at the top of your LocalSettings.php right after the starting php tag (<?php):

use GoogleLogin\Auth\GooglePrimaryAuthenticationProvider;

Let me know if that worked!

Philuko (talkcontribs)

Thanks, works like a charm!