I am trying to integrate Google oAuth 2.0 in my windows phone app.My client_secret.json file in the root directory of my project and its build action is set to content. Here is my code
var credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
new FileStream("../client_secrets.json", FileMode.Open, FileAccess.Read),
new[] { DriveService.Scope.Drive },
"user",
CancellationToken.None);
I am getting the following error
System.IO.FileNotFoundException: Could not find file 'C:\\Data\\Programs{68788282-E5AD-4D0C-84DA-C5F8EB50D947}\\client_secrets.json'
I think your path is broken some way?
This is a wild guess, but does it solve when you try this?
string yourpath = Environment.CurrentDirectory + @"\client_secrets.json";
var credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
new FileStream(yourpath, FileMode.Open, FileAccess.Read),
new[] { DriveService.Scope.Drive },
"user",
CancellationToken.None);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.