a-marenkov / gsheets

A Dart library for working with Google Sheets API.
Other
78 stars 31 forks source link

Support for user permissions grant through OAuth? #77

Closed victor-marino closed 1 year ago

victor-marino commented 2 years ago

All the examples I've seen assume the use of a service account in the credentials. However, it should also be possible to allow the user to authorize our app to read/write sheets to their personal Google Drive account, as offered by Google's API.

Is this functionality implemented? If not, will it be added?

Looking at the code in the repo, it looks like the assumption is that we will always use a service account, and not an OAuth client ID.

a-marenkov commented 2 years ago

@victor-marino

Hi Victor! As of now service account is the main way to use it.

You can create with custom client GSheets.withClient so you can use any auth from the package https://pub.dev/packages/googleapis_auth.

victor-marino commented 2 years ago

Thanks a lot @a-marenkov!

After some work I managed to get it working with a custom Google Auth client, which means the user gets a consent request screen and, if they accept, my app can create spreadsheets in their Google Drive.

Tested both on Android and also on iOS (emulator) ☺️