For php, using Google's php SDK ( https://github.com/google/google-api-php-client )
$this->client = new Client();
$this->client->setAuthConfig('your path to service_account.json');
$this->client->addScope(Drive::DRIVE);
//impersonating here
$this->client->setSubject('[email protected]');
$this->service = new Drive($this->client);