'How to set App ID when using google drive api?
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!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
