Topic on Extension talk:GoogleLogin

Manually creating a user in preparation?

5
Mqw190238 (talkcontribs)

Hello

I understand the restriction with not being able to auto create MediaWiki accounts using this extension now. That is not what this is about. How do you manually create a MediaWiki user before hand though to link the Google account to if you only have Google Login auth enabled?

If I go to /Special:CreateAccount and enter a username, ie. "Joe Bloggs" I get the error "Your Google account is already linked to another user. Please unlink the connection or contact an administrator, if you have no other wiki account." when I click on the only button I have "Create with Google". Here lies the issue I think because what is that trying to do, that button and message makes no sense? I just want to create a local user to then link them up via /Special:ManageGoogleLogin. I am not trying to do anything with mine (yes of course it's already linked).

I have $wgAuthManagerAutoConfig['primaryauth'] = []; and $wgGroupPermissions['*']['createaccount'] = false; so I think it is not allowing local creation because of that on /Special:CreateAccount? I do not want users to log in with local authentication though.

So how do you create local accounts to link Google accounts to for log in while not allowing local logins? Or I have misunderstood?

Currently I get around this manually by in the database adding a new row to the user table, then using /Special:ManageGoogleLogin to link that user and Google ID. Surely I should be able to do this all via the web UI though?

Edit: Apologies, forgot version details:

MediaWiki 1.32.0

GoogleLogin 0.4.0-git (0b27530)

Many thanks!

Florianschmidtwelzow (talkcontribs)

Hi! I might have difficulties to get the actual problem and your setup, please, if the answer does not help you, try to give some more streamlined information and please just provide necessary information which might help in this case :)

If I understood you correctly you want to have the following setup:

  • GoogleLogin is the only available authentication provider
  • Logins and account creation should be possible with Google only

If that's the case, your problem might be related to the fact, that you disabled account creation at all for every not-logged in user. You need to allow an anonmyous user to be able to login by setting $wgGroupPermissions['*']['createaccount'] = true; in your LocalSettings.php. You'll disable account creation without GoogleLogin by disabling all available authentication providers, except GoogleLogin. This can be done by adding this to your LocalSettings.php:

$wgAuthManagerConfig = [

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

];

Then you should be able to login with your Google account only. Account creation is also possible with your Google account.

Btw.: There's also this task to automatically create an account when a local account for the Google account does not exist, it is, however, not implemented, yet: https://phabricator.wikimedia.org/T186080

Please let me know, if there're still open questions :)

Best, Florian

Florianschmidtwelzow (talkcontribs)
81.61.169.155 (talkcontribs)

Hi! I followed the steps for the authoritative mode, but I still get the same problem. How do I accomplish this?:


  • GoogleLogin needs to be the only primary authentication provider


The code you posted up here returns this error:

Fatal error: Uncaught Error: Class 'GooglePrimaryAuthenticationProvider' not found in /homepages/14/d387179246/htdocs/pruebawiki/vendor/wikimedia/object-factory/src/ObjectFactory.php:77 Stack trace: #0 /homepages/14/d387179246/htdocs/pruebawiki/includes/auth/AuthManager.php(2311): Wikimedia\ObjectFactory::getObjectFromSpec(Array) #1 /homepages/14/d387179246/htdocs/pruebawiki/includes/auth/AuthManager.php(2364): MediaWiki\Auth\AuthManager->providerArrayFromSpecs('MediaWiki\\Auth\\...', Array) #2 /homepages/14/d387179246/htdocs/pruebawiki/includes/auth/AuthManager.php(922): MediaWiki\Auth\AuthManager->getPrimaryAuthenticationProviders() #3 /homepages/14/d387179246/htdocs/pruebawiki/includes/skins/SkinTemplate.php(705): MediaWiki\Auth\AuthManager->canCreateAccounts() #4 /homepages/14/d387179246/htdocs/pruebawiki/includes/skins/SkinTemplate.php(463): SkinTemplate->buildPersonalUrls() #5 /homepages/14/d387179246/htdocs/pruebawiki/includes/skins/SkinTemplate.php(228): SkinTemplate->prepareQuickTemplate() #6 /homepages/14/d38717 in /homepages/14/d387179246/htdocs/pruebawiki/vendor/wikimedia/object-factory/src/ObjectFactory.php on line 77

Thanks!

Florianschmidtwelzow (talkcontribs)

Hi!

What exactly is the configuration you added to your LoclSettings.php? And did you actually get a new copy of GoolgeLogin in the latest development version "master"?

Best, Florian

Reply to "Manually creating a user in preparation?"