Google-api-php-client: invalid_request Invalid parameter value for approval_prompt: 'auto' is not valid

Created on 21 Apr 2020  路  9Comments  路  Source: googleapis/google-api-php-client

Environment details

  • OS: docker (Debian)
  • PHP version:
php -v
PHP 7.3.16 (cli) (built: Mar 31 2020 18:48:01) ( NTS )

Hello, I've a problem with GoogleLogin Extension for mediawiki which is using Your google-api-php-client. From today (yesterday there was no problem) we're getting this error from Google:

Authorization Error
Error 400: invalid_request
Invalid parameter value for approval_prompt: 'true' is not valid

When I changed the value from 'true' to force in Client.php (Client.php#L128) file it started to work. But is this value OK? Maybe this is some kind of bug and should be fixed in other way?

Thank You for Your answer

Best Regards,
Marcin

Most helpful comment

Please use setPrompt method:
$google->setPrompt('consent');

More details in #1795

All 9 comments

The same on some our oauth applications
Environment details
OS: Amazon Linux/Docker (php:5.6-fpm)
PHP version:

php -v
PHP 5.6.40 (cli) (built: Jan 14 2019 21:32:25) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Xdebug v2.5.5, Copyright (c) 2002-2017, by Derick Rethans

Package:
"google/apiclient": "^2.1",
but also with
"google/apiclient": "^2.4",

Authorization Error
Errore 400: invalid_request
Invalid parameter value for approval_prompt: 'auto' is not valid

also try with:
$client->setApprovalPrompt("consent");
with similar error

Authorization Error
Errore 400: invalid_request
Invalid parameter value for approval_prompt: 'consent' is not valid

Please use setPrompt method:
$google->setPrompt('consent');

More details in #1795

It works, but I don't undestand why the same code yesterday works correctly...
Is there any changes on google api specs?

Please use setPrompt method:
$google->setPrompt('consent');

More details in #1795

This solve the problem
Thank you

Thank you everyone, great dialog. Thanks @inogo and @hugovk for chiming in. Im closing this issue but please comment or continue dialog if I missed anything.

@bshaffer don't you think is required to change the default value of Prompt from 'auto' to 'none' or empty as documentated on this site https://developers.google.com/identity/protocols/oauth2/openid-connect#authenticationuriparameters ?

I think default value of 'prompt' is empty string already:
https://github.com/googleapis/google-api-php-client/blob/master/src/Google/Client.php#L122

But maybe 'approval_prompt' should be changed? (even Google seems to accept 'auto' again)

Looks like Google have now fixed it, but approval_prompt isn't in the docs so I believe it probably makes sense to change it. We're keeping the change in our library.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ysaurabh33 picture ysaurabh33  路  3Comments

whatido1 picture whatido1  路  3Comments

armetiz picture armetiz  路  4Comments

usamamashkoor picture usamamashkoor  路  5Comments

artemiusgreat picture artemiusgreat  路  3Comments