I am using Below piece of code to get files with service account.
var certificate = new X509Certificate2("D:\\05-privatekey.p12", "notasecret", X509KeyStorageFlags.Exportable);
var privateKey = certificate.Export(X509ContentType.Cert);
var provider = new AssertionFlowClient(GoogleAuthenticationServer.Description, certificate)
{
ServiceAccountId = "877564787679-glrhdp0gclc9mbj77qe4998dkc6mfj62@developer.gserviceaccount.com",
Scope = DriveService.Scopes.Drive.GetStringValue(),
ServiceAccountUser = "[email protected]"
};
var auth = new OAuth2Authenticator<AssertionFlowClient>(provider, AssertionFlowClient.GetState);
DriveService service = new DriveService(new BaseClientService.Initializer()
{
Authenticator = auth,
ApplicationName = "My APP",
});
FilesResource.ListRequest request = service.Files.List();
FileList files = request.Execute();
Here Execute() api is giving exception
Error occurred while sending a direct message or getting the response.
Edit: Project is based on the settings mentioned @ https://code.google.com/p/google-api-dotnet-client/wiki/Build
Edit 2: I have proper settings in CPanel based on service account