MantisBT - TestLink
View Issue Details
0008725TestLinkAuthenticationpublic2019-07-18 19:522019-07-19 15:18
closedno change required 
DockerLinuxAWS Linux ECS
1.9.19 (2019 Q1) 
RDS Mysql
0008725: Google OAuth fails, missing / incomplete documntation

I don't want to sound rude, english is not my first language so I apologies if I may be missing good manners, that's not the idea ;)

I'm trying to set up OAuth2 using gogole as auth provider. I've done it on 5 other products so I'm a bit used to the google console part.

I don't have a clue about php.

To sum it up : I *need* a working configuration example.

Especially the 'redirect_uri'

Right now, the best result I have is this message on login page when I try.

"An error occurred during getting token"

displayed on login page
Use this configuration file, click on button 'login with google', see the message.


// Google
$tlCfg->OAuthServers = array();
$tlCfg->OAuthServers[1]['oauth_enabled'] = true;
$tlCfg->OAuthServers[1]['oauth_name'] = 'google';
$tlCfg->OAuthServers[1]['redirect_uri'] = ''; [^]
// Get from /gui/themes/default/images
$tlCfg->OAuthServers[1]['oauth_icon'] = 'google.png';
$tlCfg->OAuthServers[1]['oauth_client_id'] = '';
$tlCfg->OAuthServers[1]['oauth_client_secret'] = 'SECRETSECRET';
// Can be authorization_code (by default), client_credentials or password
$tlCfg->OAuthServers[1]['oauth_grant_type'] = 'authorization_code';
$tlCfg->OAuthServers[1]['oauth_url'] = ''; [^]
$tlCfg->OAuthServers[1]['token_url'] = ''; [^]
// false => then the only user will be selected automatically (applied for google)
$tlCfg->OAuthServers[1]['oauth_force_single'] = false;
// the domain you want to whitelist
$tlCfg->OAuthServers[1]['oauth_domain'] = '';
$tlCfg->OAuthServers[1]['oauth_profile'] = ''; [^]
$tlCfg->OAuthServers[1]['oauth_scope'] = ' [^]'; [^]


From the README on github I saw google auth was supported. (but did anyone read that readme and understood what to do about what ?)

From some old mantis tickets (2017) I tried to figure out a bit more.

'the config file' ... which is apparently "" is not even mentioned in installation documentation. (not nowing about php, beieve me it's a bit strange to use source code files as configuration, so a pointer would be welcome :) )

I finally found '' example on github but ... looks like its content does not match the expected syntax, it has no result.

Finally looking inside main config file I managed to buid forementioned configuration file, with no idea what I should leave or not commneted out.

Tried dozen of combinations, to no result.

thank you !

No tags attached.
Issue History
2019-07-18 19:52squalouNew Issue
2019-07-18 19:57squalouNote Added: 0029035
2019-07-18 20:02squalouNote Edited: 0029035bug_revision_view_page.php?bugnote_id=29035#r5904
2019-07-18 20:12squalouNote Added: 0029036
2019-07-19 15:18fmanQA Team - Task Workflow Status => TBD
2019-07-19 15:18fmanStatusnew => closed
2019-07-19 15:18fmanAssigned To => fman
2019-07-19 15:18fmanResolutionopen => no change required

2019-07-18 19:57   
(edited on: 2019-07-18 20:02)
I'm using 'bitnami' docker image
version 1.9.19-r145

2019-07-18 20:12   
Ok, looks like my issue resieds in lib/functions/oauth_providers/google.php

especially the way redirect_uri is taken, and it looks like it's fixed on testlink_1_9 brnch but not in my docker image.


I still have

'redirect_uri' => isset($_SERVER['HTTPS']) ? 'https://' [^] : 'http://' [^] . $_SERVER[HTTP_HOST]. '/login.php?oauth=google',

If I replace by

'redirect_uri' => $authCfg['redirect_uri'],

works better...

Also, documentation / working example seems on its way on next version .. so feel free to close this as wont fix or duplicate or whatever