'Stream audio file from Google Drive returns Code 403
I want to stream an audio file from Google Drive. The Google Drive file is public, so who has the link can access it.
Creating the link works in my app as described below:
- login in Google Drive (Drive is in production, and downloading files works)
- Scan account for audiofiles
- get id from audiofile
- generate linke from audiofile
generate link like:
String link = getFiles().get(i).getWebContentLink()+"&access_token="+acessTokenDrive+"&alt=media";
Example Link: https://drive.google.com/uc?id=<FileID>&access_token=<Token>&alt=media
the link works in chrome and edge browser (with and without logged in user) but not in the app.
Checking availibility of audiofile with
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
int code = connection.getResponseCode();
returns 403 (and no quotas reached), but are there any other restrictions or limitations
After further testing, I found that for few files the getWebContentLink
works, then the 403 errors occurs.
Any suggestions?
Thanks, GGK
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|