5

Is it possible to present the Google Picker to a user who isn't logged in with her Google account? I would like to let the user select files from a shared Google Drive of the Google account of my website. I can access these files with OAuth on the server. But is it also possible to present the files with Google Picker? Maybe with this method:

PickerBuilder.setOAuthToken(string)

Sets an OAuth token to use for authenticating the current user. Depending on the scope of the token, only certain views will display data. Valid scopes are Google Docs, Drive, and Photos. This method should be used instead of .setAuthUser when a user is authenticated with OAuth.

Google Picker API reference

I have tried this and I think it is not possible. Or is it?

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
Korneel
  • 1,487
  • 14
  • 40

1 Answers1

1

This method of the API does work (I use it currently). Just note that the auth token from google expires and you may need to refresh your token otherwise the google picker will return a 401 when trying to retrieve the list of files from google drive.

PickerBuilder.setOAuthToken(string)
Arthur Frankel
  • 4,695
  • 6
  • 35
  • 56
  • Have you tried logging out of Google and then picking a file from Google Drive without being logged in? – Korneel Dec 05 '12 at 08:05
  • Yes - that works fine. What issues are you having? You can also try the google oauth playground to test out the use of the auth token (without being logged in). – Arthur Frankel Dec 07 '12 at 20:33
  • @ArthurFrankel .How can i get auth token from script – sowmya Apr 28 '20 at 07:54