Google php client library loadServiceAccountJson broken - fix enclosed

前端 未结 1 1772
北恋
北恋 2020-12-20 10:38

The new function in the php library loadServiceAccountJson doesn\'t allow setting sub in the Google_Auth_AssertionCredentials creator, so always gi

相关标签:
1条回答
  • 2020-12-20 10:45

    New Google API is bit different now:

    $client = new Google_Client();
    $client->setApplicationName("YourAppName");
    $client->setAuthConfig(<JSON-Config-File-Location>);
    $client->setScopes(array("https://www.googleapis.com/auth/admin.directory.user.readonly", "https://www.googleapis.com/auth/admin.directory.group.readonly"));
    $client->setSubject(<User-Email-To-Impersonate>);
    
    $service = new Google_Service_Directory($client);
    $results = $service->users->listUsers(array('domain' => '<your-domain-name>'));
    

    I'm still trying to figure out how can I get this without the need to impersonate user?

    0 讨论(0)
提交回复
热议问题