I created a service account, got json configuration file and I request an access token using it. The response is ok, I receive token. When I upload file using it everything is o
I found out what was the problem. I was sending access token in the url address instead of in the header. Eventually I did it like this:
public List getFilesList() {
Http http = new Http();
HttpRequest req = new HttpRequest();
req.setMethod('GET');
req.setEndpoint('https://www.googleapis.com/drive/v2/files);
req.setHeader('Authorization', 'Bearer '+accessToken);
HttpResponse resp = http.send(req);
return null;
}