KurtDeGreeff / google-gdata

Automatically exported from code.google.com/p/google-gdata
0 stars 0 forks source link

Execution of request failed: http://gdata.youtube.com/action/GetUploadToken. Results (401) Unauthorized in Windows Vista #172

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
First of all, I'm sorry for my english, it's very poor.

I'm trying to upload videos in youtube using the Youtube API for .NET.
I get an account in youtube, the developers key,...
A week ago, with the same code, I accomplished to upload videos
without problems from another pc. But today I'm trying to do it from
my home and I'm getting the same message every time:

[WebException: Error en el servidor remoto: (401) No autorizado.]
  System.Net.HttpWebRequest.GetResponse() +1532114
  Google.GData.Client.GDataRequest.Execute() +114

[GDataRequestException: Execution of request failed:
http://gdata.youtube.com/action/GetUploadToken]
  Google.GData.Client.GDataRequest.Execute() +209
  Google.GData.Client.GDataGAuthRequest.Execute(Int32 retryCounter)
+406
  Google.GData.Client.GDataGAuthRequest.Execute() +29
  Google.GData.Client.Service.EntrySend(Uri feedUri, AtomBase
baseEntry, GDataRequestType type, AsyncSendData data) +278
  Google.GData.Client.MediaService.EntrySend(Uri feedUri, AtomBase
baseEntry, GDataRequestType type, AsyncSendData data) +262
  Google.GData.Client.Service.EntrySend(Uri feedUri, AtomBase
baseEntry, GDataRequestType type) +39
  Google.GData.YouTube.YouTubeService.FormUpload(YouTubeEntry
newEntry) +127
  YouTubeAPITest.Button1_Click(Object sender, EventArgs e) in c:\Users
\oscar\Desktop\Proyecto SECRETO\YouTubeTest\YouTubeAPITest.aspx.cs:95
  System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
  System.Web.UI.WebControls.Button.RaisePostBackEvent(String
eventArgument) +107

System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBa
ckEvent(String
eventArgument) +7
  System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +11
  System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
+33
  System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+1746

Sorry, the message is in spanish, the traduction is something like
this: [WebException: Error in the remote server: (401) Unauthorized.]

I'm working in a Windows Vista machine, Visual Studio 2005 and C#, the
difference with the system in wich the application works, or used to
work, is the operating system Windows XP.

Here is the code:

       #region Service autentication

       YouTubeService service = new
YouTubeService("xxxxxxxxxxxxxxxxxxl",
           "xxxxxxxxxxxxxxxxxxxxxxxxx",

"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");

       #endregion

       YouTubeEntry newEntry = new YouTubeEntry();
       FormUploadToken token;
       StringBuilder formUploaderSrc = new
StringBuilder("FormYouTubeUploader.htm");

       #region User autentication

       service.setUserCredentials("xxxxxxxxxxxxxxxxxxx",
"xxxxxxxxxxxxxxxxxxxx");

       #endregion

       newEntry.Media = new MediaGroup();

       newEntry.Media.Keywords = new MediaKeywords(txtKeywords.Text);
       newEntry.Media.Description = new
MediaDescription(txtDescription.Text);
       newEntry.Media.Title = new MediaTitle(txtTitle.Text);

       newEntry.Media.Categories.Add(
           new MediaCategory(lstCategory.SelectedValue,
YouTubeNameTable.CategorySchema));

       token = service.FormUpload(newEntry); // EXCEPTION LINE

I have another machine with Windows XP installed. I thought that I can try
to run the application in this environtment and...the application is
working without problems. Then I retry in Windows Vista and the problem
stills. I don't know what to think: it can't be a firewall problem because
gets a response...

Original issue reported on code.google.com by osr...@gmail.com on 19 Sep 2008 at 10:02

GoogleCodeExporter commented 9 years ago
can you send me the HTTP exchange for that denied request? attach the log 
(obtained by fiddler) to the bug, but 
make sure to change the auth headers to not expose this to the public. 

Original comment by fman...@gmail.com on 24 Sep 2008 at 4:43

GoogleCodeExporter commented 9 years ago
Hi, finally I found the solution: It was Kaspersky Antivirus.

I'm ashamed...I was trying to produce a report with Fiddler without results. 
Then I
tried to do the same in a Windows XP virtual machine that I have installed. The
problem was in the virtual machine too. So I thought that it can be the 
Firewall or
the anti-virus of the host machine...After stop the Firewall without any 
improvement
I tried to close the antivirus protection and it works.

Sorry for make you to lost your time.

Thanks for your help.

Original comment by osr...@gmail.com on 25 Sep 2008 at 8:25

GoogleCodeExporter commented 9 years ago
Happens to all of us. I am sure you can tweak Kaspersky to allow those requests 
though

Original comment by fman...@gmail.com on 26 Sep 2008 at 6:18

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Hi

I am using C#.net for youtube API

I'm getting this error like 

Execution of request failed:
http://uploads.gdata.youtube.com/feeds/api/users/username/uploads 

code

 YouTubeRequestSettings settings = new YouTubeRequestSettings("example app", "client
ID", "developer key");
            YouTubeRequest request = new YouTubeRequest(settings);
            Video newVideo = new Video();
            newVideo.Title = "My Test Movie";
            newVideo.Tags.Add(new MediaCategory("Autos",
YouTubeNameTable.CategorySchema));
            newVideo.Keywords = "cars, funny";
            newVideo.Description = "My description";
            newVideo.YouTubeEntry.Private = false;
            newVideo.Tags.Add(new MediaCategory("mydevtag, anotherdevtag",
YouTubeNameTable.DeveloperTagSchema));
            newVideo.YouTubeEntry.Location = new
Google.GData.Extensions.Location.GeoRssWhere(37, -122);
            newVideo.YouTubeEntry.MediaSource = new
MediaFileSource(Server.MapPath("Check.wmv"), "video/quicktime");
            Video createdVideo = request.Upload("username", newVideo);

pls help me

Original comment by doss.sel...@gmail.com on 7 Jul 2009 at 10:37

GoogleCodeExporter commented 9 years ago
Please post this in the youtube discussion forum and include the ResponseString 
property of the exception....

Original comment by fman...@gmail.com on 7 Jul 2009 at 10:51