I am developing Xamarin.Forms application and what I am trying to do is:
- Authenticate user in Google with Auth0 2.0
- After that I receive token response
- Get all spreadsheets inside user's account
Currently, I know that Google updated quite a lot their API with latest version and I no more can use SpreadsheetsService
. What I see in official documentation is that they're using SheetsService
, at least that's what they've here.
This is my code right now:
var service = new SheetsService(new BaseClientService.Initializer
{
HttpClientInitializer = this.userCredential,
ApplicationName = Statics.StaticStrings.AppDomain.ApplicationName
});
var spreadsheetId = "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms";
var range = "Class Data!A2:E";
SpreadsheetsResource.ValuesResource.GetRequest request = service.Spreadsheets.Values.Get(spreadsheetId, range);
So far it's working, but the problem that I have is that I can get spreadsheet if I have it's ID, but I am not sure from where I can get it and, of course I don't want to hard code it (makes no sense).
this.userCredential
is field from type Google.Apis.Auth.OAuth2.UserCredential
, where I pass (IAuthorizationCodeFlow flow, string userId, TokenResponse token)
, so after I pass token I expect that my user will be already logged in.
My question here is, how can I get all spreadsheets to which authenticated user is authorized, so I can use them after that?
Thanks in advance!