Home > Software design >  How to force OAuth2 to get data from Youtube API
How to force OAuth2 to get data from Youtube API

Time:11-20

I want to use OAuth2 login and I also need to view Youtube data. How can I force the check box to be checked? Thanks!

My PHP login code:

$google_client = new Google_Client();
//auth
$google_client->setClientId(ClientID);
$google_client->setClientSecret(SecretKey);

$google_client->setRedirectUri('https://example.com');
$google_client->setAccessType('offline');
$google_client->setApprovalPrompt('force');
$google_client->setIncludeGrantedScopes(true);
$google_client->addScope(array(
    'email', 'profile', 'https://www.googleapis.com/auth/youtube.readonly'
));

It is always like this when the user tries to login for the first time.

CodePudding user response:

The checkboxes are due to the rolling out of granular account permission system, they are completely normal, and can not be turned off.

More granular Google Account permissions with Google OAuth and APIs

  • Related