Cannot download files anymoreDrive API download without loginGoogle Drive API - Queries randomly fail on TokenResponseException (Invalid Request/Internal Failure)Google API to upload files using the Authentication Service AccountDownload files from google driveGoogle API: ServiceAccount errors with DirectoryService and DriveService using C#Google Drive API v3 use JSON instead of P12 (Service Account) - Unexpected characterHow to change the created name shown on file details in Google Drive when using C# Google Drive API with OAuth to upload a file?How to view files added through google service accountGoogle Drive Service Account - file list returns only a file named “Getting started”Google API file create permissions
Pre-mixing cryogenic fuels and using only one fuel tank
How to explain what's wrong with this application of the chain rule?
Loading commands from file
What should you do if you miss a job interview (deliberately)?
Why electric field inside a cavity of a non-conducting sphere not zero?
What is Cash Advance APR?
Multiplicative persistence
Delivering sarcasm
Why do compilers behave differently when static_cast(ing) a function to void*?
Is there a name for this algorithm to calculate the concentration of a mixture of two solutions containing the same solute?
Fear of getting stuck on one programming language / technology that is not used in my country
Closed-form expression for certain product
Why is it that I can sometimes guess the next note?
why `nmap 192.168.1.97` returns less services than `nmap 127.0.0.1`?
Approximating irrational number to rational number
How can "mimic phobia" be cured or prevented?
"Spoil" vs "Ruin"
Count the occurrence of each unique word in the file
It grows, but water kills it
If a character has darkvision, can they see through an area of nonmagical darkness filled with lightly obscuring gas?
Longest common substring in linear time
Store Credit Card Information in Password Manager?
Why did the EU agree to delay the Brexit deadline?
Why should universal income be universal?
Cannot download files anymore
Drive API download without loginGoogle Drive API - Queries randomly fail on TokenResponseException (Invalid Request/Internal Failure)Google API to upload files using the Authentication Service AccountDownload files from google driveGoogle API: ServiceAccount errors with DirectoryService and DriveService using C#Google Drive API v3 use JSON instead of P12 (Service Account) - Unexpected characterHow to change the created name shown on file details in Google Drive when using C# Google Drive API with OAuth to upload a file?How to view files added through google service accountGoogle Drive Service Account - file list returns only a file named “Getting started”Google API file create permissions
I've got a system where we're using a Service Account to connect to the Google Drive SDK. It's been working fine for about 6 months, but starting a week ago, with no code changes, it's no longer able to download files from the Google Drive. We're still able to List files, but downloads are now bouncing to an authorization page rather than downloading the file. I'm certain that my Service Account has permissions to the file.
To down the file, I use the following code:
var downloader = new MediaDownloader(driveService);
var stream = new MemoryStream();
var download = await downloader.DownloadAsync(file.Url, stream);
if (download.Exception != null) throw download.Exception;
// Reset to the begining for replay
stream.Seek(0, SeekOrigin.Begin);
return stream;
c# google-api google-drive-sdk google-api-dotnet-client
|
show 6 more comments
I've got a system where we're using a Service Account to connect to the Google Drive SDK. It's been working fine for about 6 months, but starting a week ago, with no code changes, it's no longer able to download files from the Google Drive. We're still able to List files, but downloads are now bouncing to an authorization page rather than downloading the file. I'm certain that my Service Account has permissions to the file.
To down the file, I use the following code:
var downloader = new MediaDownloader(driveService);
var stream = new MemoryStream();
var download = await downloader.DownloadAsync(file.Url, stream);
if (download.Exception != null) throw download.Exception;
// Reset to the begining for replay
stream.Seek(0, SeekOrigin.Begin);
return stream;
c# google-api google-drive-sdk google-api-dotnet-client
What scope are you using? Check the directory and the file permissions to be sure the service account has access.
– DaImTo
Mar 8 at 7:12
My scopes areDriveService.Scope.DriveFile, DriveService.Scope.Drive
. My service account has access to both the directory and the file. I'm able to list the file, and can see the service account on the permissions. Also recall that this DID work, then mysteriously stopped working, with no code changes, so I don't think it's likely to be a a scoping issue.
– heneryville
Mar 11 at 15:23
Does the official sample github.com/google/google-api-dotnet-client-samples/tree/master/… works as is if you just change your auth parameters?
– Simon Mourier
Mar 12 at 8:02
Any chance you've got some restrictions in place? cloud.google.com/docs/authentication/…
– Andrew Harris
Mar 13 at 21:56
Are you using API v2 or v3?
– AwonDanag
Mar 14 at 4:10
|
show 6 more comments
I've got a system where we're using a Service Account to connect to the Google Drive SDK. It's been working fine for about 6 months, but starting a week ago, with no code changes, it's no longer able to download files from the Google Drive. We're still able to List files, but downloads are now bouncing to an authorization page rather than downloading the file. I'm certain that my Service Account has permissions to the file.
To down the file, I use the following code:
var downloader = new MediaDownloader(driveService);
var stream = new MemoryStream();
var download = await downloader.DownloadAsync(file.Url, stream);
if (download.Exception != null) throw download.Exception;
// Reset to the begining for replay
stream.Seek(0, SeekOrigin.Begin);
return stream;
c# google-api google-drive-sdk google-api-dotnet-client
I've got a system where we're using a Service Account to connect to the Google Drive SDK. It's been working fine for about 6 months, but starting a week ago, with no code changes, it's no longer able to download files from the Google Drive. We're still able to List files, but downloads are now bouncing to an authorization page rather than downloading the file. I'm certain that my Service Account has permissions to the file.
To down the file, I use the following code:
var downloader = new MediaDownloader(driveService);
var stream = new MemoryStream();
var download = await downloader.DownloadAsync(file.Url, stream);
if (download.Exception != null) throw download.Exception;
// Reset to the begining for replay
stream.Seek(0, SeekOrigin.Begin);
return stream;
c# google-api google-drive-sdk google-api-dotnet-client
c# google-api google-drive-sdk google-api-dotnet-client
edited Mar 8 at 7:12
DaImTo
46.5k1166246
46.5k1166246
asked Mar 8 at 4:47
heneryvilleheneryville
1,75511526
1,75511526
What scope are you using? Check the directory and the file permissions to be sure the service account has access.
– DaImTo
Mar 8 at 7:12
My scopes areDriveService.Scope.DriveFile, DriveService.Scope.Drive
. My service account has access to both the directory and the file. I'm able to list the file, and can see the service account on the permissions. Also recall that this DID work, then mysteriously stopped working, with no code changes, so I don't think it's likely to be a a scoping issue.
– heneryville
Mar 11 at 15:23
Does the official sample github.com/google/google-api-dotnet-client-samples/tree/master/… works as is if you just change your auth parameters?
– Simon Mourier
Mar 12 at 8:02
Any chance you've got some restrictions in place? cloud.google.com/docs/authentication/…
– Andrew Harris
Mar 13 at 21:56
Are you using API v2 or v3?
– AwonDanag
Mar 14 at 4:10
|
show 6 more comments
What scope are you using? Check the directory and the file permissions to be sure the service account has access.
– DaImTo
Mar 8 at 7:12
My scopes areDriveService.Scope.DriveFile, DriveService.Scope.Drive
. My service account has access to both the directory and the file. I'm able to list the file, and can see the service account on the permissions. Also recall that this DID work, then mysteriously stopped working, with no code changes, so I don't think it's likely to be a a scoping issue.
– heneryville
Mar 11 at 15:23
Does the official sample github.com/google/google-api-dotnet-client-samples/tree/master/… works as is if you just change your auth parameters?
– Simon Mourier
Mar 12 at 8:02
Any chance you've got some restrictions in place? cloud.google.com/docs/authentication/…
– Andrew Harris
Mar 13 at 21:56
Are you using API v2 or v3?
– AwonDanag
Mar 14 at 4:10
What scope are you using? Check the directory and the file permissions to be sure the service account has access.
– DaImTo
Mar 8 at 7:12
What scope are you using? Check the directory and the file permissions to be sure the service account has access.
– DaImTo
Mar 8 at 7:12
My scopes are
DriveService.Scope.DriveFile, DriveService.Scope.Drive
. My service account has access to both the directory and the file. I'm able to list the file, and can see the service account on the permissions. Also recall that this DID work, then mysteriously stopped working, with no code changes, so I don't think it's likely to be a a scoping issue.– heneryville
Mar 11 at 15:23
My scopes are
DriveService.Scope.DriveFile, DriveService.Scope.Drive
. My service account has access to both the directory and the file. I'm able to list the file, and can see the service account on the permissions. Also recall that this DID work, then mysteriously stopped working, with no code changes, so I don't think it's likely to be a a scoping issue.– heneryville
Mar 11 at 15:23
Does the official sample github.com/google/google-api-dotnet-client-samples/tree/master/… works as is if you just change your auth parameters?
– Simon Mourier
Mar 12 at 8:02
Does the official sample github.com/google/google-api-dotnet-client-samples/tree/master/… works as is if you just change your auth parameters?
– Simon Mourier
Mar 12 at 8:02
Any chance you've got some restrictions in place? cloud.google.com/docs/authentication/…
– Andrew Harris
Mar 13 at 21:56
Any chance you've got some restrictions in place? cloud.google.com/docs/authentication/…
– Andrew Harris
Mar 13 at 21:56
Are you using API v2 or v3?
– AwonDanag
Mar 14 at 4:10
Are you using API v2 or v3?
– AwonDanag
Mar 14 at 4:10
|
show 6 more comments
2 Answers
2
active
oldest
votes
Solution
You can share
The folder of (xxxxx@gmail.com)
With (xxx@xxx.iam.gserviceaccount.com)
then the same code will work
Why
There are 2 users :
GClould service account (xxx@xxx.iam.gserviceaccount.com)
Google Drive account (xxxxx@gmail.com)
You can't use your GClould service account to access Google Drive App
How
add a comment |
I had a similar issue and this worked for me:
Google.Apis.Drive.v2.Data.File file = service.Files.Get(fileId).Execute();
if (!file.MimeType.Equals("application/vnd.google-apps.spreadsheet"))
//for files use another Url
exportUrl = file.DownloadUrl;
var response = service.HttpClient.GetByteArrayAsync(exportUrl).Result;
Stream downloadStream = new MemoryStream(response);
New contributor
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55056886%2fcannot-download-files-anymore%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Solution
You can share
The folder of (xxxxx@gmail.com)
With (xxx@xxx.iam.gserviceaccount.com)
then the same code will work
Why
There are 2 users :
GClould service account (xxx@xxx.iam.gserviceaccount.com)
Google Drive account (xxxxx@gmail.com)
You can't use your GClould service account to access Google Drive App
How
add a comment |
Solution
You can share
The folder of (xxxxx@gmail.com)
With (xxx@xxx.iam.gserviceaccount.com)
then the same code will work
Why
There are 2 users :
GClould service account (xxx@xxx.iam.gserviceaccount.com)
Google Drive account (xxxxx@gmail.com)
You can't use your GClould service account to access Google Drive App
How
add a comment |
Solution
You can share
The folder of (xxxxx@gmail.com)
With (xxx@xxx.iam.gserviceaccount.com)
then the same code will work
Why
There are 2 users :
GClould service account (xxx@xxx.iam.gserviceaccount.com)
Google Drive account (xxxxx@gmail.com)
You can't use your GClould service account to access Google Drive App
How
Solution
You can share
The folder of (xxxxx@gmail.com)
With (xxx@xxx.iam.gserviceaccount.com)
then the same code will work
Why
There are 2 users :
GClould service account (xxx@xxx.iam.gserviceaccount.com)
Google Drive account (xxxxx@gmail.com)
You can't use your GClould service account to access Google Drive App
How
edited Mar 19 at 1:26
answered Mar 19 at 1:20
Mohamed ElrashidMohamed Elrashid
2,02511024
2,02511024
add a comment |
add a comment |
I had a similar issue and this worked for me:
Google.Apis.Drive.v2.Data.File file = service.Files.Get(fileId).Execute();
if (!file.MimeType.Equals("application/vnd.google-apps.spreadsheet"))
//for files use another Url
exportUrl = file.DownloadUrl;
var response = service.HttpClient.GetByteArrayAsync(exportUrl).Result;
Stream downloadStream = new MemoryStream(response);
New contributor
add a comment |
I had a similar issue and this worked for me:
Google.Apis.Drive.v2.Data.File file = service.Files.Get(fileId).Execute();
if (!file.MimeType.Equals("application/vnd.google-apps.spreadsheet"))
//for files use another Url
exportUrl = file.DownloadUrl;
var response = service.HttpClient.GetByteArrayAsync(exportUrl).Result;
Stream downloadStream = new MemoryStream(response);
New contributor
add a comment |
I had a similar issue and this worked for me:
Google.Apis.Drive.v2.Data.File file = service.Files.Get(fileId).Execute();
if (!file.MimeType.Equals("application/vnd.google-apps.spreadsheet"))
//for files use another Url
exportUrl = file.DownloadUrl;
var response = service.HttpClient.GetByteArrayAsync(exportUrl).Result;
Stream downloadStream = new MemoryStream(response);
New contributor
I had a similar issue and this worked for me:
Google.Apis.Drive.v2.Data.File file = service.Files.Get(fileId).Execute();
if (!file.MimeType.Equals("application/vnd.google-apps.spreadsheet"))
//for files use another Url
exportUrl = file.DownloadUrl;
var response = service.HttpClient.GetByteArrayAsync(exportUrl).Result;
Stream downloadStream = new MemoryStream(response);
New contributor
New contributor
answered Mar 19 at 15:49
ChrisBChrisB
12
12
New contributor
New contributor
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55056886%2fcannot-download-files-anymore%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What scope are you using? Check the directory and the file permissions to be sure the service account has access.
– DaImTo
Mar 8 at 7:12
My scopes are
DriveService.Scope.DriveFile, DriveService.Scope.Drive
. My service account has access to both the directory and the file. I'm able to list the file, and can see the service account on the permissions. Also recall that this DID work, then mysteriously stopped working, with no code changes, so I don't think it's likely to be a a scoping issue.– heneryville
Mar 11 at 15:23
Does the official sample github.com/google/google-api-dotnet-client-samples/tree/master/… works as is if you just change your auth parameters?
– Simon Mourier
Mar 12 at 8:02
Any chance you've got some restrictions in place? cloud.google.com/docs/authentication/…
– Andrew Harris
Mar 13 at 21:56
Are you using API v2 or v3?
– AwonDanag
Mar 14 at 4:10