I am getting a error while connecting my web application to google drive. This my C# code to connect
I have created a project in google drive. Then Copied the OAuth 2.0 client IDs. Then I copied the file into my D drive and given path in web application.
I have marked the error line in red color.
public static DriveService GetService()
{
UserCredential credential;
using (var stream = new FileStream(@"D:\client_secret.json", FileMode.Open, FileAccess.Read))
{
String FolderPath = @"D:\";
String FilePath = Path.Combine(FolderPath, "DriveServiceCredentials.json");
credential = GoogleWebAuthorizationBroker.AuthorizeAsync(GoogleClientSecrets.Load(stream).Secrets, Scopes, "bineesh", CancellationToken.None, new FileDataStore(FilePath, true)).Result;
}
//Create Drive API service.
DriveService service = new DriveService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "GoogleDriveRestAPI-v3",
});
return service;
}
I have attached the error screenshot with this. Please find it and let me know how i can solve this issue.