I am working on a Golang service that will connect to Google Drive and download a file. The issue is that no matter how I update the projects permissions, when I run application and go to the browser window to OAuth, it only shows the metadata
permissions needing granted when have granted more so that I can download files.
Here are the steps I've taken for the service:
I have created a project in Google Developer Console.
In that project I have enabled and updated Google Drive permissions to the capture all auth/drive
permission (I have also tried granting all and only some granular).
I create the Golang service from this example: https://developers.google.com/drive/api/v3/quickstart/go
I run the Golang app which prompts me to open a URL in browser to OAuth authenticate.
I open link in browser, auth with my app-owner gmail account and every single time no matter what I do this is the only OAuth scope that shows:
If I use the Drive API Explorer to perform the file download it shows that I need these permissions:
When i click "Execute" in the explorer the OAuth popup shows all the permissions I would expect for my app and works correctly:
What am I doing wrong or missing?
Could this be because the app is an "internal" app?
The issue was in the Golang Quick-Start boilerplate code that I used to scaffold the application.
This line was overriding the permission settings I was explicitly setting in console.
// If modifying these scopes, delete your previously saved token.json.
config, err := google.ConfigFromJSON(b, drive.DriveMetadataReadonlyScope)
if err != nil {
log.Fatalf("Unable to parse client secret file to config: %v", err)
}
fixed when changed to:
// If modifying these scopes, delete your previously saved token.json.
config, err := google.ConfigFromJSON(b, drive.DriveScope)
if err != nil {
log.Fatalf("Unable to parse client secret file to config: %v", err)
}