I'm working with drive v2 API to upload files to google drive using Oauth2.0. This is how I get the thumbnail link of the file.
com.google.api.services.drive.model.File fileMetadata = new com.google.api.services.drive.model.File();
fileMetadata.setParents(Arrays.asList(new ParentReference().setId(parentFolderId)));
fileMetadata.setTitle(file.getName());
fileMetadata.setMimeType(type);
java.io.File filePath = new java.io.File(file.getAbsolutePath());
FileContent mediaContent = new FileContent(type, filePath);
com.google.api.services.drive.model.File f = service.files().insert(fileMetadata, mediaContent).execute();
String thumbnailLink = f.getThumbnailLink()
I'm using this thumbnailLink to show images in my web application. Does this thumbnailLink will have validity? Because when i tried to use the thumbnail link after sometime i got an 403 error.
Your client does not have permission to get URL /Bvz7wBXoC_pXJWfbJ44iEryxrXxB5w7JLU9He8ErJ2OjWEZg2EJCqBL1ElfIUdVx--IHqw=s220 from this server. (Client IP address: x.x.x.x)
I have tried with these Google Drive - Unable to download thumbnails with an authenticated (OAuth2) request , https://productforums.google.com/forum/#!topic/chromebook-central/YvNs0J5IgS0 Still I'm facing the same issue. Is there any way I can overcome this? When i upload the same image again it works for sometime but after sometime again the same issue.