Extension talk:GoogleLogin

Jump to navigation Jump to search

About this board

$wgGLAuthoritativeMode default value 'false'?

2
110.76.76.83 (talkcontribs)

Document says $wgGLAuthoritativeMode is 'false' string literal by default, but I suspect that it needs to be false boolean.

Florianschmidtwelzow (talkcontribs)
97.120.73.165 (talkcontribs)

Hi there,


I'd like to add the "Log in with Google" button to the "Login Required" page.


I want to use the exact same button as GoogleLogin does, but add it to MediaWiki:Loginreqpagetext. Is that possible?


Why you ask? Because I've had mobile users complain of difficulty trying to click on the "log in" text, and said they'd really appreciate a button to click on.


Thanks in advance for any help!

Knomanii (talkcontribs)

I used Template:Branded_Button to customize my own Login button and added the Google logo from Google Sign-In Branding Guidelines. Obviously I had to adjust the template somewhat — removing the opacity, removing all off-set and customizing margins. I tried to get as close as I could to the Branding Guidelines. Here's how it ended up:

login required page

If anyone knows how GoogleLogin's login button was constructed, I'd love to use that instead though!

Knomanii (talkcontribs)

I actually did run into some issues with around needing the full login URL including the &returnto= section to get links to follow correctly. Here's how I dealt with that in case anyone else runs into the same issue:

Topic:Vsn0j6jc4lkjifpx

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! :)

Missing Id_token and setAccessToken

2
GuardianCosmos (talkcontribs)

Getting the following error with everything configured according to documentation, wondering if the latest build has a typo or similar that could be causing this? The accounts are already properly linked.

Mediawiki version 1.31.2 and plugin version 0.4.0-git

[127ff4480901c5e4d43dc2c0] /mediawiki/index.php/Special:LinkAccounts LogicException from line 712 of /var/lib/mediawiki/extensions/GoogleLogin/vendor/google/apiclient/src/Google/Client.php: id_token must be passed in or set as part of setAccessToken

Backtrace:

#0 /var/lib/mediawiki/extensions/GoogleLogin/includes/Auth/GooglePrimaryAuthenticationProvider.php(263): Google_Client->verifyIdToken()

#1 /usr/share/mediawiki/includes/auth/AuthManager.php(1950): GoogleLogin\Auth\GooglePrimaryAuthenticationProvider->continuePrimaryAccountLink(User, array)

#2 /usr/share/mediawiki/includes/specialpage/AuthManagerSpecialPage.php(364): MediaWiki\Auth\AuthManager->continueAccountLink(array)

#3 /usr/share/mediawiki/includes/specialpage/AuthManagerSpecialPage.php(482): AuthManagerSpecialPage->performAuthenticationStep(string, array)

#4 /usr/share/mediawiki/includes/htmlform/HTMLForm.php(660): AuthManagerSpecialPage->handleFormSubmit(array, OOUIHTMLForm)

#5 /usr/share/mediawiki/includes/specialpage/AuthManagerSpecialPage.php(416): HTMLForm->trySubmit()

#6 /usr/share/mediawiki/includes/specials/SpecialLinkAccounts.php(59): AuthManagerSpecialPage->trySubmit()

#7 /usr/share/mediawiki/includes/specialpage/SpecialPage.php(565): SpecialLinkAccounts->execute(NULL)

#8 /usr/share/mediawiki/includes/specialpage/SpecialPageFactory.php(568): SpecialPage->run(NULL)

#9 /usr/share/mediawiki/includes/MediaWiki.php(288): SpecialPageFactory::executePath(Title, RequestContext)

#10 /usr/share/mediawiki/includes/MediaWiki.php(861): MediaWiki->performRequest()

#11 /usr/share/mediawiki/includes/MediaWiki.php(524): MediaWiki->main()

#12 /usr/share/mediawiki/index.php(42): MediaWiki->run()

#13 {main}

@Florianschmidtwelzow

Florianschmidtwelzow (talkcontribs)

Hi!

Thanks for pointing this out, I tried to recreate this issue, however, I was unable to do so. Did you really have installed the latest versions and also updated the composer dependencies? From what I saw in the code, this behaviour should be nearly impossible to reach (that's also why there's a logic exception). Did you tried to link the account again?

Thanks in advance for your answer :)

Best, Florian

Reply to "Missing Id_token and setAccessToken"

Invalid Request - Missing required Parameter: client_id

2
157.130.31.226 (talkcontribs)

Hi - I just installed this extension, ran update on my db, and added the configuration as follows:

<?php
$wgGLSecret = 'MYSECRET';
$wgGLAppId = 'MY CLIENT ID';
$wgGLAllowedDomains = array('mydomain.com');
$wgGLReplaceMWLogin = true;
$wgGLForceKeepLogin = true;
$wgWhitelistRead = array( 'Special:GoogleLogin' );
require_once("$IP/extensions/GoogleLogin/GoogleLogin.php");

And when I click the "Log in with Google" button on the new log in form, I see this from google:

400. That’s an error.

Error: invalid_request

Missing required parameter: client_id

Learn more

Request Details
scope=https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email
response_type=code
access_type=online
redirect_uri=http://mydomain.com/index.php?title=Special:GoogleLogin
approval_prompt=auto
client_id=
That’s all we know.

Any ideas?

Florianschmidtwelzow (talkcontribs)

Hi,

please move the configuration under the require_once line, otherwise your configuration in LocalSettings.php will be overwritten by the default configuration :)

Best, Florian

Reply to "Invalid Request - Missing required Parameter: client_id"

Error 404 on link 'official step-by-step example'

3
Summary by Wladek92

done; using common link to console.

Wladek92 (talkcontribs)
Florianschmidtwelzow (talkcontribs)

I removed the link. If you think that something is missing or not as easy explained in the step-by-step guide, you're more than welcome to add clarifications :)

Wladek92 (talkcontribs)

Thanks. Please dont close topics before issue has been validated.

Is there any way to keep original login/signup but use GoogleLogin as additional option?

2
Tiwari.mayank24 (talkcontribs)

Hey,


I was able to complete the setup using


wfLoadExtension( 'GoogleLogin' );
$wgGLSecret = '';
$wgGLAppId = '-.apps.googleusercontent.com';
$wgGLAuthoritativeMode = 'true';
$wgGroupPermissions['*']['autocreateaccount'] = true;
$wgInvalidUsernameCharacters = "%";
$wgUserrightsInterwikiDelimiter = "%";
$wgInvalidUsernameCharacters = "%";
$wgAuthManagerConfig = [
    'primaryauth' => [
        GoogleLogin\Auth\GooglePrimaryAuthenticationProvider::class => [
            "class" => GoogleLogin\Auth\GooglePrimaryAuthenticationProvider::class,
            "sort" => 0
        ]
    ],
    'preauth' => [],
    'secondaryauth' => [],
];


But this disabled the traditional login/signup completely, but we are a public wiki and have hundreds of users and profiles, with lots of contributions and not possibly using google based accout. Is there any way to keep old login/signup and use google as additional option to signup/login ?

Florianschmidtwelzow (talkcontribs)

If you remove the config `$wgAuthManagerConfig` from your LocalSettings.php, GoogleLogin should automatically register itself _additionally_ to any other authentication provider (like the "traditional" username/password login). :)

Reply to "Is there any way to keep original login/signup but use GoogleLogin as additional option?"

Message: Signature verification failed

6
109.230.45.242 (talkcontribs)

Oops, there was an error. Please go back and try again. Message: Signature verification failed


I can not login

Datapharmer (talkcontribs)

Update The Google API PHP Client under vendors/Google from the git listed on the main page.

109.230.45.242 (talkcontribs)

well, shouldn't this be the error message then? The generic error message does not help and not other debug log is provided.

109.230.45.242 (talkcontribs)

No, still does not work


installed:

composer require google/apiclient:"^2.0"

109.230.45.242 (talkcontribs)

OK it works now, but no the main vendor/ folder should be updated, but the specific extension folder. I call messy development.

Florianschmidtwelzow (talkcontribs)

> I call messy development. You're more than welcome to make things better :)

In your case it seems, that you're using the composer merge plugin, but still run composer update in each extension, isn't it? If so, this would explain why you even have two google api clients in two different verndor folders.

Reply to "Message: Signature verification failed"
2A02:8010:9006:1000:91E5:1856:3707:260C (talkcontribs)

Hi there,


I've installed GoogleLogin and it is working as expected, however it does not show under "Installed extensions" on the Special:Version page.


Is this expected?


What might I have done wrong?


Many thanks

Florianschmidtwelzow (talkcontribs)

Error con Extension talk:GoogleLogin

2
Nahueldev (talkcontribs)

Hola, estoy tratando de usar GoogleLogin, al momento de terminar la configuracion basica y querer loguearme me genera el siguiente error.

[bd7e4d07ed69db2b93b74049] /mw19/index.php?title=Special:UserLogin&returnto=Main+Page Error from line 27 of /home/koiurban/elbucle.com.ar/mw19/extensions/GoogleLogin/includes/GoogleLogin.php: Class 'Google_Client' not found

Backtrace:

#0 /home/koiurban/elbucle.com.ar/mw19/extensions/GoogleLogin/includes/Auth/GooglePrimaryAuthenticationProvider.php(393): GoogleLogin\GoogleLogin::getClient(string, string)

#1 /home/koiurban/elbucle.com.ar/mw19/extensions/GoogleLogin/includes/Auth/GooglePrimaryAuthenticationProvider.php(373): GoogleLogin\Auth\GooglePrimaryAuthenticationProvider->getGoogleClient()

#2 /home/koiurban/elbucle.com.ar/mw19/extensions/GoogleLogin/includes/Auth/GooglePrimaryAuthenticationProvider.php(41): GoogleLogin\Auth\GooglePrimaryAuthenticationProvider->beginGoogleAuthentication(array, string)

#3 /home/koiurban/elbucle.com.ar/mw19/includes/auth/AuthManager.php(458): GoogleLogin\Auth\GooglePrimaryAuthenticationProvider->beginPrimaryAuthentication(array)

#4 /home/koiurban/elbucle.com.ar/mw19/includes/auth/AuthManager.php(388): MediaWiki\Auth\AuthManager->continueAuthentication(array)

#5 /home/koiurban/elbucle.com.ar/mw19/includes/specialpage/AuthManagerSpecialPage.php(354): MediaWiki\Auth\AuthManager->beginAuthentication(array, string)

#6 /home/koiurban/elbucle.com.ar/mw19/includes/specialpage/AuthManagerSpecialPage.php(484): AuthManagerSpecialPage->performAuthenticationStep(string, array)

#7 /home/koiurban/elbucle.com.ar/mw19/includes/htmlform/HTMLForm.php(690): AuthManagerSpecialPage->handleFormSubmit(array, VFormHTMLForm)

#8 /home/koiurban/elbucle.com.ar/mw19/includes/specialpage/AuthManagerSpecialPage.php(417): HTMLForm->trySubmit()

#9 /home/koiurban/elbucle.com.ar/mw19/includes/specialpage/LoginSignupSpecialPage.php(313): AuthManagerSpecialPage->trySubmit()

#10 /home/koiurban/elbucle.com.ar/mw19/includes/specialpage/SpecialPage.php(575): LoginSignupSpecialPage->execute(NULL)

#11 /home/koiurban/elbucle.com.ar/mw19/includes/specialpage/SpecialPageFactory.php(611): SpecialPage->run(NULL)

#12 /home/koiurban/elbucle.com.ar/mw19/includes/MediaWiki.php(296): MediaWiki\Special\SpecialPageFactory->executePath(Title, RequestContext)

#13 /home/koiurban/elbucle.com.ar/mw19/includes/MediaWiki.php(900): MediaWiki->performRequest()

#14 /home/koiurban/elbucle.com.ar/mw19/includes/MediaWiki.php(527): MediaWiki->main()

#15 /home/koiurban/elbucle.com.ar/mw19/index.php(44): MediaWiki->run()

#16 {main}


Este es mi LocalSettings,


#GoogleLogin

wfLoadExtension (  'GoogleLogin'  );

#config

$wgGLSecret  =  'idsecret' ;

$wgGLAppId  =  'appid' ;

$wgGLReplaceMWLogin = true;

$wgGLForceKeepLogin = true;

$wgWhitelistRead = array( 'Special:GoogleLogin' );

#errores

$wgShowExceptionDetails=true;

Podrian ayudarme y comentarme donde estaria fallando, ??


Slds

PiotrKotowski (talkcontribs)

Hey,

in my case I had the same error with mediawiki 1.34 and Google Login plugin. To solve the issue I had :

- downloaded the master version of plugin (latest development version)

- set up composer

- adjusted composer.json :

"require": {
       "guzzlehttp/guzzle": "dev-6.5-functions as 6.5.3"
   },
   "repositories": [
       {"type": "vcs", "url": "git@github.com:GrahamCampbell/guzzle.git"}
   ]


- run 'composer update composer update --no-dev'


Also, I needed to run ' php updatePublicSuffixArray.php' (from maintenance dir) since I had been generally updating the mediawiki.


Good luck,

Piotr

Reply to "Error con Extension talk:GoogleLogin"