Cannot list all files and folder in Google Drive using Device Code (OAuth 2.0 for TV and Limited-Input Device Applications)

41 Views Asked by At

I am trying to support a Scan to Google Drive feature for a Printer and one of its function aside from uploading files to Google Drive is to list the files and folder in Google Drive.

From my study the most appropriate OAuth2.0 type to get the access token is using the device code flow based on [https://developers.google.com/identity/protocols/oauth2/limited-input-device](Google Limited Input Device), because the printer I'm working on cannot support "redirect_uri" which is required for other authentication flow.

However, based on the Google API document, only the following Google Drive scope is supported (https://developers.google.com/identity/protocols/oauth2/limited-input-device#allowedscopes).

  • drive.appdata
  • drive.file

"https://www.googleapis.com/auth/drive.file" scope only display the list of files and folder created by the same app. Therefore at first time when the user login using Google Drive, no files and folder will be listed.

But when I check other Printer Google Drive support using the same device code flow, example the HP Multifunctional printer (https://www.youtube.com/watch?v=elCGhg4M8kg) it seems it can use the scope "**https://www.googleapis.com/auth/drive**", which allows to view all files and folder regardless of who created the files and folder. How is this possible? HP MFP Google Drive sample screenshot

Is there a special configuration or setup in Google Console needed to bypass the limitation of the Device Code Flow support for Google Drive APIs?

I already check answers from similar questions, but I'm still wondering how does HP MFP can use the "https://www.googleapis.com/auth/drive" scope when using the "OAuth 2.0 for TV and Limited-Input Device Applications".

Any help is appreciated. Thank you very much in advance.

0

There are 0 best solutions below