var sourceFolderId = "15Kux2yyL_OWoZBwnYPbJtyrlp1zQjY3T";
var folder = DriveApp.getFolderById(sourceFolderId);
var token = ScriptApp.getOAuthToken()
var imageUrl = folder.getFilesByName(uid).next().getDownloadUrl() + "&access_token=" +
ScriptApp.getOAuthToken();
var slide = Slides.Presentations.get(newTargetDocId).slides[0]
Logger.log(token)
Logger.log(imageUrl)
I have been using the above code to get an image from google drive and using batchupdate put it into google slides, however the auth token no longer allows a download, do i need to refresh it somehow?
The url goes to the correct image and the image is the correct file format but the code returns
API call to slides.presentations.batchUpdate failed with error: Invalid requests[1].createImage: The provided image is in an unsupported format. (line 243, file "Code").
I know the image is ok as i have already used it. I know the url is correct as it takes me to the image if i cut the authtoken off. The authtoken on the end no longer allows me to download the file on another browser.
New code based on comment about Drive changes
var sourceFolderId = "15Ku...............zQjY3T";
var folder = DriveApp.getFolderById(sourceFolderId);
var file = folder.getFilesByName(uid).next()
file.setSharing(DriveApp.Access.ANYONE_WITH_LINK, DriveApp.Permission.VIEW);
var imageUrl = "https://drive.google.com/uc?export=download&id=" + file.getId();
But now i get an invalid argument error on file.setSharing line