googleapis / google-api-php-client

A PHP client library for accessing Google APIs
http://googleapis.github.io/google-api-php-client/
Apache License 2.0
9.31k stars 3.52k forks source link

How to set "enable_granular_consent" parameter on Client.php? #2581

Open ninsky opened 6 months ago

ninsky commented 6 months ago

I've got an email from Google telling me that users of my Google Client (created before 2019) will get displayed a granular consent screen from June 2024. Therefore I need to set the "enable_granular_consent" parameter on the Google Client. This parameter is set by default for newer Google Client IDs according to google developers doc.

Now I've checked the most current version of the Client.php and it seems that there is no such function to set this parameter. Any idea how I could fix this or whether this function will be added to the Client.php soonish?

Thanks in advance Nino

ninsky commented 6 months ago

I was able to set the parameter on createAuthUrl().

alebedev80 commented 6 months ago

@ninsky please provide code snippet

ninsky commented 6 months ago

Here we go: return $this->googleClient->createAuthUrl([Google_Service_Oauth2::USERINFO_PROFILE, Google_Service_Oauth2::USERINFO_EMAIL], ['enable_granular_consent' => 'true']);

alebedev80 commented 6 months ago

I've created PR