csharp newbie
csharp newbie

Reputation: 638

UserCredential class from google apis not found

Im using ms vs express 2012 win desktop and trying to compile this code example https://developers.google.com/youtube/v3/code_samples/dotnet#upload_a_video

I got nuget packages like Google.Apis.YouTube.v3, Google.Apis.Authentication and Google APIs Client Library. Now I got couple hundreds dlls, some of them is duplicating.

Added following references

enter image description here

My using directives:

using System;
using System.IO;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;

using Google.Apis;

using Google.Apis.Authentication.OAuth2;
using Google.Apis.Authentication.OAuth2.DotNetOpenAuth;
using Google.Apis.Services;
using Google.Apis.Upload;
using Google.Apis.Util.Store;
using Google.Apis.YouTube;
using Google.Apis.YouTube.v3;
using Google.Apis.YouTube.v3.Data;

Compilation fails with following errors:

UserCredential can not be found (missing using directive?)

GoogleWebAuthorizationBroker does not exist

GoogleClientSecrets does not exist

What reference or using directive do I need? GoogleWebAuthorizationBroker seems to require Google.Apis.Auth.PlatformServices - I have Google.Apis.Authenication.PlatformServices reference, doesn't helps.

Upvotes: 1

Views: 1018

Answers (2)

peleyal
peleyal

Reputation: 3512

We stopped using DotNetOpenAuth and Google.Apis.Authentication (https://www.nuget.org/packages/Google.Apis.Authentication/ is obsolete) almost 3 years ago. Notice that the sample in https://developers.google.com/youtube/v3/code_samples/dotnet#upload_a_video actually uses the right usings.

I recommend you cleaning your project and reinstall the YouTube NuGet package, it will install all the right dependencies for you.

Upvotes: 3

csharp newbie
csharp newbie

Reputation: 638

Apparently there is a different version of some dlls, some of them have Google.Apis.Authentication structure while other one have Google.Apis.Auth, so you need to find one with Auth and code will compile!

Upvotes: 0

Related Questions