I’m integrating Google Drive Picker in an Electron app using @googleworkspace/drive-picker-element.
My OAuth flow works correctly:
Open OAuth URL:
https://accounts.google.com/o/oauth2/v2/authresponse_type=code
access_type=offline
prompt=consent
Redirect to localhost and receive authorization code
Exchange code for token via:
https://oauth2.googleapis.com/token
I can successfully get:
access_token
refresh_token
id_token
and the access token works with Drive API:
GET https://www.googleapis.com/drive/v3/files
returns data successfully.
Problem
When I use the token with Drive Picker:
the picker internally opens:
https://docs.google.com/picker?...
and this request returns 401.
Important observation
If I request OAuth with:
https://www.googleapis.com/auth/drive.readonly
Picker works correctly.
But if I request OAuth with:
https://www.googleapis.com/auth/drive.file
Picker consistently returns 401.
This is confusing because Google documentation suggests Picker supports drive.file, and products like Notion also appear to use drive.file.
Already checked
access token is valid
Drive API works with same token
OAuth code flow works
client_id,app_id, and API key are from same Google Cloud projectGoogle Drive API enabled
Google Picker API enabled
Authorized JavaScript origins configured correctly
developer-keyprovidedlogin-hinttested (email and sub)same issue in logged-in and logged-out browser states
Additional scopes tested:
openid
userinfo.email
userinfo.profile
No change.
Question
Does Google Drive Picker currently support drive.file with drive-picker-docs-view / "all" view?
Are there additional requirements or limitations when using drive.file with Picker?
Is drive.readonly effectively required for browsing files in Picker?
Any clarification would be appreciated.
Thanks.