0

I'm currently writing a desktop/mobile app with flutter. Specifically on desktop, I'm trying to gain access to google drive files using the https://www.googleapis.com/auth/drive.file' scope.

If I run the following dart code to create a file

void createFile async {
  final driveApi = DriveApi(someOAuthClient);
  final foo = File(name: "foo.bar");
  await driveApi.files.create(foo);
}

And then do the following to query for files:

void getTheFiles() async {
  final driveApi = DriveApi(someOAuthClient);
  final files = await driveApi.files.list();
  ...
}

The files query always comes out empty. I read from here that the issue is we need to first set the app_id otherwise google drive doesn't think we have access to any of the files on the drive.

How do we set the app id using the Drive API?

I've found plenty of references to The google drive picker with the setAppId() function, but can't seem to find any way of setting the app id specifically using the Drive API itself.

I would assume this data is some how part of each files metadata and that there'd be some way to set the app ID for the files we create from the app via the File constructor - but so far haven't really found anything concrete to point out where or how to set this. Possibly it could be set in the appProperites or properties fields, but if that's so, there's no indicators in the documentation of what key we need to use for the app ID to make it work.

Any advise or direction is greatly appreciated!

Vance Palacio
  • 980
  • 10
  • 16
  • After toying around with this all afternoon, it turns out I may have been conflating different issues. Setting the App ID may not actually be important for my use case, and files do seem to be appearing now from my queries, so perhaps it's a non-issue. I'll leave this question around though in case there's some important info someone might be looking for – Vance Palacio Apr 02 '22 at 02:42

0 Answers0