Using .NET Google API for web service

76 views
Skip to first unread message

Jay Anderson

unread,
Aug 5, 2015, 1:07:49 PM8/5/15
to google-api-dotnet-client
I'm looking to build a webservice that will consume the YouTube APIs. My issue is with authentication. I have the following from examples:

UserCredential credential;
using (var stream = new FileStream("client_secrets.json", FileMode.Open, FileAccess.Read))
{
credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.Load(stream).Secrets,
new[] { YouTubeService.Scope.YoutubeUpload },
"user",
CancellationToken.None
);
}

var youtubeService = new YouTubeService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "ApplicationName"
});

However, this opens up an authentication prompt in a web browser. Is there anyway I can avoid that?

Linda Lawton

unread,
Sep 7, 2015, 9:49:55 AM9/7/15
to google-api-dotnet-client

No the authentication window will always open in a web browser.

Reply all
Reply to author
Forward
0 new messages