Donato Tesse
unread,Oct 22, 2015, 2:40:08 PM10/22/15Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google-api-dotnet-client
Hi
I have a web site and I use this code to authenticate:
public static YouTubeService AuthenticateOauth()
{
string[] scopes = new string[] { YouTubeService.Scope.Youtube, // view and manage your YouTube account
YouTubeService.Scope.YoutubeForceSsl,
YouTubeService.Scope.Youtubepartner,
YouTubeService.Scope.YoutubepartnerChannelAudit,
YouTubeService.Scope.YoutubeReadonly,
YouTubeService.Scope.YoutubeUpload};
try
{
var folder = System.Web.HttpContext.Current.Server.MapPath(fileDataStore);
Log.LogWrite("err", "AuthenticateOauth", folder, "folder");
// here is where we Request the user to give us access, or use the Refresh Token that was previously stored in %AppData%
UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(new ClientSecrets { ClientId = ClientId, ClientSecret = ClientSecret }
, scopes
, Username
, CancellationToken.None
, new FileDataStore(folder)).Result;
YouTubeService service = new YouTubeService(new YouTubeService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = Account,
});
return service;
}
catch (Exception ex)
{
Log.LogWrite("err", "AuthenticateOauth", ex.Message, ex.InnerException.Message);
return null;
}
return service;*/
}
But I get this error:
"Access is denied"
Why?
Thanks