After updating Google.Apis.Oauth2.v2
NuGet package to v. 1.60.0.1869, I start getting exception Access to the path C:\Users is denied when trying login with Google in my UWP
app. Here's my code:
string fname = @"Assets\User\Auth\google_client_secrets.json";
StorageFolder InstallationFolder = Windows.ApplicationModel.Package.Current.InstalledLocation;
var stream = await InstallationFolder.OpenStreamForReadAsync(fname);
credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
stream,
new[] { "profile", "email" },
"me",
CancellationToken.None);
The exception occurs in GoogleWebAuthorizationBroker.AuthorizeAsync
call.
This code (with some light changes) worked well before with Google.Apis.Oauth2.v2 package v. 1.25.0.859, but now this package is obsolete and doesn't work anymore.
How to login with Google in my UWP app?
NOTE: I understand that UWP app doesn't have access to c:\Users, but my code never request anything in the folder. google_client_secrets.json exists and I can read it in the app from the stream, so this file is unrelated to the issue.
UPDATE
After I set the 5th parameter of AuthorizeAsync
like this:
credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
stream,
new[] { "profile", "email" },
"me",
CancellationToken.None
new FileDataStore(ApplicationData.Current.LocalCacheFolder.Path, true));
the exception is gone. Now the execution thread just dies inside the AuthorizeAsync
and I start getting the following error popup: