Issue 716 in google-gdata: Execution of authentication request returned unexpected result: 404

387 views
Skip to first unread message

google...@googlecode.com

unread,
May 26, 2015, 4:39:24 PM5/26/15
to gdata-dotnet-...@googlegroups.com
Status: New
Owner: ----

New issue 716 by APUS...@gmail.com: Execution of authentication request
returned unexpected result: 404
https://code.google.com/p/google-gdata/issues/detail?id=716

What steps will reproduce the problem?
1. After the "GA_Service.Credentials = new GDataCredentials (strGAUserName,
strGAPassword);"
2.var token = GA_Service.QueryAuthenticationToken();
3. GA_Service.SetAuthenticationToken(token);

What is the expected output? What do you see instead?

It was working fine, but now i get this error after 10 times of data pull.


What version of the product are you using? On what operating system?
Google.GData.Analytics V 2.2.0.0

Please provide any additional information below.


--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

google...@googlecode.com

unread,
May 26, 2015, 5:30:18 PM5/26/15
to gdata-dotnet-...@googlegroups.com

Comment #1 on issue 716 by evilstee...@gmail.com: Execution of
authentication request returned unexpected result: 404
https://code.google.com/p/google-gdata/issues/detail?id=716

I am having the very same problem - my code has been working for two years
without any issues. Same exception:

Unhandled Exception: Google.GData.Client.GDataRequestException: Execution
of aut hentication request returned unexpected result: 404 at
Google.GData.Client.Utilities.getAuthException(TokenCollection tokens, Htt
pWebResponse response) at
Google.GData.Client.Utilities.QueryClientLoginToken(GDataCredentials gc, S
tring serviceName, String applicationName, Boolean fUseKeepAlive, IWebProxy
prox yServer, Uri clientLoginHandler) at
Google.GData.Client.GDataGAuthRequest.QueryAuthToken(GDataCredentials gc)
at Google.GData.Client.GDataGAuthRequest.EnsureCredentials() at
Google.GData.Client.GDataRequest.EnsureWebRequest() at
Google.GData.Client.GDataGAuthRequest.EnsureWebRequest() at
Google.GData.Client.GDataRequest.Execute() at
Google.GData.Client.GDataGAuthRequest.Execute(Int32 retryCounter) at
Google.GData.Client.GDataGAuthRequest.Execute() at
Google.GData.Client.Service.Query(Uri queryUri, DateTime ifModifiedSince,
String etag, Int64& contentLength) at
Google.GData.Client.Service.Query(FeedQuery feedQuery) at
Google.GData.Documents.DocumentsService.Query(DocumentsListQuery feedQuery
) at GoogleLogger.GoogleService.getLastXECLogRows(String folderName, String
fileName, Int32 rows)

This is occurring on my production system, so it's a huge problem for us.

google...@googlecode.com

unread,
May 26, 2015, 5:36:25 PM5/26/15
to gdata-dotnet-...@googlegroups.com

Comment #2 on issue 716 by evilstee...@gmail.com: Execution of
authentication request returned unexpected result: 404
https://code.google.com/p/google-gdata/issues/detail?id=716

This site is down:
https://developers.google.com/accounts/RegistrationForWebApps

google...@googlecode.com

unread,
May 26, 2015, 6:27:42 PM5/26/15
to gdata-dotnet-...@googlegroups.com

Comment #3 on issue 716 by k...@kuwaitculturela.org: Execution of
authentication request returned unexpected result: 404
https://code.google.com/p/google-gdata/issues/detail?id=716

I am getting a similar issue. Getting 404'ed when it was working fine just
prior to 14:53 PST. I'm using Google.GData.Spreadsheets 2.2.0.0

google...@googlecode.com

unread,
May 26, 2015, 6:50:39 PM5/26/15
to gdata-dotnet-...@googlegroups.com

Comment #4 on issue 716 by evilstee...@gmail.com: Execution of
authentication request returned unexpected result: 404
https://code.google.com/p/google-gdata/issues/detail?id=716

I take it you guys all use the GData API still? I have been digging around
and it seems that there is a new API:

https://developers.google.com/drive/web/quickstart/quickstart-cs

I really hope that the old GData API is still supported or we'll have to
rewrite everything. BTW the new Drive API is not supported by .Net 3.5 - so
this is a huge disaster for me.

google...@googlecode.com

unread,
May 26, 2015, 9:02:03 PM5/26/15
to gdata-dotnet-...@googlegroups.com

Comment #5 on issue 716 by APUS...@gmail.com: Execution of authentication
request returned unexpected result: 404
https://code.google.com/p/google-gdata/issues/detail?id=716

yes .. it was working fine until 3 PM ET today .. then BOOM!!!!!

anyone found the solution???

google...@googlecode.com

unread,
May 26, 2015, 9:25:27 PM5/26/15
to gdata-dotnet-...@googlegroups.com

Comment #6 on issue 716 by ad...@dloweb.com: Execution of authentication
request returned unexpected result: 404
https://code.google.com/p/google-gdata/issues/detail?id=716

I have the same problem. Authentication is not working for me at all. I
really don't want to rewrite everything either.

google...@googlecode.com

unread,
May 26, 2015, 9:54:30 PM5/26/15
to gdata-dotnet-...@googlegroups.com

Comment #7 on issue 716 by lhfied...@gmail.com: Execution of authentication
request returned unexpected result: 404
https://code.google.com/p/google-gdata/issues/detail?id=716

I'm seeing the same issue ...

Type
Google.GData.Client.GDataRequestException

Message
Execution of authentication request returned unexpected result: 404

Stack ...
at Google.GData.Client.Utilities.getAuthException(TokenCollection tokens,
HttpWebResponse response) at
Google.GData.Client.Utilities.QueryClientLoginToken(GDataCredentials gc,
String serviceName, String applicationName, Boolean fUseKeepAlive,
IWebProxy proxyServer, Uri clientLoginHandler) at
Google.GData.Client.GDataGAuthRequest.QueryAuthToken(GDataCredentials gc)
at Google.GData.Client.GDataGAuthRequest.EnsureCredentials() at
Google.GData.Client.GDataRequest.EnsureWebRequest() at
Google.GData.Client.GDataGAuthRequest.EnsureWebRequest() at
Google.GData.Client.GDataRequest.Execute() at
Google.GData.Client.GDataGAuthRequest.Execute(Int32 retryCounter) at
Google.GData.Client.Service.Query(Uri queryUri, DateTime ifModifiedSince,
String etag, Int64& contentLength) at
Google.GData.Client.Service.Query(FeedQuery feedQuery) at
Google.GData.Spreadsheets.SpreadsheetsService.Query(SpreadsheetQuery
feedQuery)

google...@googlecode.com

unread,
May 26, 2015, 10:57:47 PM5/26/15
to gdata-dotnet-...@googlegroups.com

Comment #8 on issue 716 by aynch...@gmail.com: Execution of authentication
request returned unexpected result: 404
https://code.google.com/p/google-gdata/issues/detail?id=716

Also experiencing the error with em client accessing Google contacts. Works
for email and calendar, but not for contacts since 12 pm PST today.

google...@googlecode.com

unread,
May 26, 2015, 10:58:48 PM5/26/15
to gdata-dotnet-...@googlegroups.com

Comment #9 on issue 716 by yuceloz...@gmail.com: Execution of
authentication request returned unexpected result: 404
https://code.google.com/p/google-gdata/issues/detail?id=716

Also Sample Applications give the same error. Anybody get error on version
2.1 ?

google...@googlecode.com

unread,
May 26, 2015, 11:11:08 PM5/26/15
to gdata-dotnet-...@googlegroups.com

Comment #10 on issue 716 by wang.zha...@gosugroup.com: Execution of
authentication request returned unexpected result: 404
https://code.google.com/p/google-gdata/issues/detail?id=716

I get same issue today. hurry!

google...@googlecode.com

unread,
May 26, 2015, 11:39:49 PM5/26/15
to gdata-dotnet-...@googlegroups.com

Comment #11 on issue 716 by eron...@gmail.com: Execution of authentication
request returned unexpected result: 404
https://code.google.com/p/google-gdata/issues/detail?id=716

Same here, i'm using GData API v2.2

google...@googlecode.com

unread,
May 26, 2015, 11:47:39 PM5/26/15
to gdata-dotnet-...@googlegroups.com

Comment #12 on issue 716 by dmonkey1...@gmail.com: Execution of
authentication request returned unexpected result: 404
https://code.google.com/p/google-gdata/issues/detail?id=716

There is a note on the sheets API page
(https://developers.google.com/google-apps/spreadsheets/authorize) saying
that OAuth1.0 will be killed off on May 5th and you have to use the OAuth
2.0 service.

google...@googlecode.com

unread,
May 27, 2015, 12:51:57 AM5/27/15
to gdata-dotnet-...@googlegroups.com

Comment #13 on issue 716 by alex....@cantaloupesys.com: Execution of
authentication request returned unexpected result: 404
https://code.google.com/p/google-gdata/issues/detail?id=716

I am also started this issue around 12pm PDT.

Google.GData.Client.GDataRequestException: Execution of authentication
request returned unexpected result: 404
at Google.GData.Client.Utilities.getAuthException(TokenCollection
tokens, HttpWebResponse response)
at Google.GData.Client.Utilities.QueryClientLoginToken(GDataCredentials
gc, String serviceName, String applicationName, Boolean fUseKeepAlive,
IWebProxy proxyServer, Uri clientLoginHandler)
at Google.GData.Client.GDataGAuthRequest.QueryAuthToken(GDataCredentials
gc)
at
Google.GData.Client.GDataGAuthRequestFactory.QueryAuthToken(GDataCredentials
gc)
at Google.GData.Client.Service.QueryClientLoginToken()

google...@googlecode.com

unread,
May 27, 2015, 1:32:53 AM5/27/15
to gdata-dotnet-...@googlegroups.com

Comment #14 on issue 716 by sunny198...@gmail.com: Execution of
authentication request returned unexpected result: 404
https://code.google.com/p/google-gdata/issues/detail?id=716

Please update if someone find solution.

google...@googlecode.com

unread,
May 27, 2015, 1:38:26 AM5/27/15
to gdata-dotnet-...@googlegroups.com

Comment #15 on issue 716 by sunny198...@gmail.com: Execution of
authentication request returned unexpected result: 404
https://code.google.com/p/google-gdata/issues/detail?id=716

Please update if someone find solution.I am getting this issue when try to
read group names,till yesterday everything was working fine.
Following is the exception which i am getting:

at Google.GData.Client.Utilities.getAuthException(TokenCollection tokens,
HttpWebResponse response)
at Google.GData.Client.Utilities.QueryClientLoginToken(GDataCredentials
gc, String serviceName, String applicationName, Boolean fUseKeepAlive,
IWebProxy proxyServer, Uri clientLoginHandler)
at Google.GData.Client.GDataGAuthRequest.QueryAuthToken(GDataCredentials
gc)
at Google.GData.Client.GDataGAuthRequest.EnsureCredentials()
at Google.GData.Client.GDataRequest.EnsureWebRequest()
at Google.GData.Client.GDataGAuthRequest.EnsureWebRequest()
at Google.GData.Client.GDataRequest.Execute()
at Google.GData.Client.GDataGAuthRequest.Execute(Int32 retryCounter)
at Google.GData.Client.GDataGAuthRequest.Execute()
at Google.GData.Client.Service.Query(Uri queryUri, DateTime
ifModifiedSince, String etag, Int64& contentLength)
at Google.GData.Client.Service.Query(Uri queryUri, DateTime
ifModifiedSince)
at Google.GData.Client.Service.Query(FeedQuery feedQuery)
at Google.GData.Client.Feed`1.get_AtomFeed()
at Google.GData.Client.Feed`1.<get_Entries>d__0.MoveNext()
at IMAPCommands.GetGroups.PrintAllGroups(ContactsRequest cr) in
e:\back\TestFolder\IMAPCommands\IMAPCommands\GetGroups.cs:line 18
at IMAPCommands.Program.Main(String[] args) in
e:\back\TestFolder\IMAPCommands\IMAPCommands\Program.cs:line 22
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[]
args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext
executionContext, ContextCallback callback, Object state, Boolean
preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state, Boolean
preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

google...@googlecode.com

unread,
May 27, 2015, 1:44:29 AM5/27/15
to gdata-dotnet-...@googlegroups.com

Comment #16 on issue 716 by off...@e-cosmetorium.com: Execution of
authentication request returned unexpected result: 404
https://code.google.com/p/google-gdata/issues/detail?id=716

I have exactly the same problem... My production systems depends on google
docs and I have a major disaster now. Any knows if google is working on
that ?

google...@googlecode.com

unread,
May 27, 2015, 1:49:00 AM5/27/15
to gdata-dotnet-...@googlegroups.com

Comment #17 on issue 716 by off...@e-cosmetorium.com: Execution of
authentication request returned unexpected result: 404
https://code.google.com/p/google-gdata/issues/detail?id=716

Guys isn't it somehow connected with the information:
'OAuth 1.0 is no longer supported and will be disabled on May 5, 2015'
https://developers.google.com/google-apps/spreadsheets/authorize

Anyone migrate code to use OAuth 2.0 and thus solved the problem?

google...@googlecode.com

unread,
May 27, 2015, 1:51:03 AM5/27/15
to gdata-dotnet-...@googlegroups.com

Comment #18 on issue 716 by sunny198...@gmail.com: Execution of
authentication request returned unexpected result: 404
https://code.google.com/p/google-gdata/issues/detail?id=716

But today is 27 May.

google...@googlecode.com

unread,
May 27, 2015, 1:52:23 AM5/27/15
to gdata-dotnet-...@googlegroups.com

Comment #19 on issue 716 by sunny198...@gmail.com: Execution of
authentication request returned unexpected result: 404
https://code.google.com/p/google-gdata/issues/detail?id=716

But today is 27 May :-), Why it is reflecting after almost 20 days.

google...@googlecode.com

unread,
May 27, 2015, 1:57:10 AM5/27/15
to gdata-dotnet-...@googlegroups.com

Comment #20 on issue 716 by off...@e-cosmetorium.com: Execution of
authentication request returned unexpected result: 404
https://code.google.com/p/google-gdata/issues/detail?id=716

No idea why it may take an effect 20 days later.
Any one who have code snippet in .NET with the authentication OAuth 2.0 , I
try to solve it on production as fast as I can now.

Thanks

google...@googlecode.com

unread,
May 27, 2015, 2:38:05 AM5/27/15
to gdata-dotnet-...@googlegroups.com

Comment #21 on issue 716 by pallavi....@paxcel.net: Execution of
authentication request returned unexpected result: 404
https://code.google.com/p/google-gdata/issues/detail?id=716

Anybody has a fix ? Please let us know immediately

google...@googlecode.com

unread,
May 27, 2015, 2:42:00 AM5/27/15
to gdata-dotnet-...@googlegroups.com

Comment #22 on issue 716 by sangeeth...@gmail.com: Execution of
authentication request returned unexpected result: 404
https://code.google.com/p/google-gdata/issues/detail?id=716



While fetching gmail contact details m getting "Execution of authentication
request returned unexpected result: 404" Exception ... please kindly help
me to sort out this issue as earlier as possible.


Below mention is my Code
RequestSettings rs = new RequestSettings("MyNetwork Web Application!",
TEmailID, Tpass);
rs.AutoPaging = true;
ContactsRequest cr = new ContactsRequest(rs);
Feed<Contact> f = cr.GetContacts();

google...@googlecode.com

unread,
May 27, 2015, 3:55:04 AM5/27/15
to gdata-dotnet-...@googlegroups.com

Comment #23 on issue 716 by evilstee...@gmail.com: Execution of
authentication request returned unexpected result: 404
https://code.google.com/p/google-gdata/issues/detail?id=716

Clearly we'll need to use OAuth2 but the only examples I've run across use
copy/pasting a URL into a web browser and retrieving it, and then pasting
it into the command line:

https://developers.google.com/google-apps/spreadsheets/authorize

I'm running an application outside of a web browser, so that's not an
option. We need to find an OAuth2 example that works without manually
accepting a token.

google...@googlecode.com

unread,
May 27, 2015, 4:05:21 AM5/27/15
to gdata-dotnet-...@googlegroups.com

Comment #24 on issue 716 by sangeeth...@gmail.com: Execution of
authentication request returned unexpected result: 404
https://code.google.com/p/google-gdata/issues/detail?id=716

M using GContacts Data API provided by Google to retrieve contacts from
gmail ... using asp.net c#(VS2010). Please guide me how to solve this
problem.

what is this OAuth2?

google...@googlecode.com

unread,
May 27, 2015, 6:38:51 AM5/27/15
to gdata-dotnet-...@googlegroups.com

Comment #25 on issue 716 by a.kopa...@oorraa.net: Execution of
authentication request returned unexpected result: 404
https://code.google.com/p/google-gdata/issues/detail?id=716

I've managed to solve this by using this solution with Service Account with
oAuth2.0
http://stackoverflow.com/questions/13664731/accessing-older-gdata-apis-spreadsheet-api-using-oauth-2-and-a-service-account

The solution:
1. Create Project and Google Service Account in
https://console.developers.google.com/project
2. Generate your p12 key.
3. Allow APIs in Developer console you want to use (basically we are going
to use old API, so you can skip this step, but just in case)
4. Use the code below (.NET Framework 4.5!):

using System.Security.Cryptography.X509Certificates;
using Google.GData.Client;
using Google.GData.Extensions;
using Google.GData.Spreadsheets;
using Google.Apis.Auth.OAuth2;

string keyFilePath = @"C:\key.p12"; // found in developer console
string serviceAccountEmail = "youra...@developer.gserviceaccount.com";
// found in developer console
var certificate = new X509Certificate2(keyFilePath, "notasecret",
X509KeyStorageFlags.Exportable);

ServiceAccountCredential credential = new ServiceAccountCredential(new
ServiceAccountCredential.Initializer(serviceAccountEmail) //create
credential using certigicate
{
Scopes = new[] { "https://spreadsheets.google.com/feeds/" }
//this scopr is for spreadsheets, check google scope FAQ for others
}.FromCertificate(certificate));

credential.RequestAccessTokenAsync(System.Threading.CancellationToken.None).Wait();
//request
token

var requestFactory = new GDataRequestFactory("Some Name");
requestFactory.CustomHeaders.Add(string.Format("Authorization: Bearer {0}",
credential.Token.AccessToken));

SpreadsheetsService myService = new SpreadsheetsService("You App Name");
//create your old service
myService.RequestFactory = requestFactory; //add new request factory to
your old service

SpreadsheetQuery query = new SpreadsheetQuery(); //do the job as you done
it before
SpreadsheetFeed feed = myService.Query(query);

google...@googlecode.com

unread,
May 27, 2015, 6:49:11 AM5/27/15
to gdata-dotnet-...@googlegroups.com

Comment #26 on issue 716 by a.kopa...@oorraa.net: Execution of
authentication request returned unexpected result: 404
https://code.google.com/p/google-gdata/issues/detail?id=716

Also don't forget to grant "youra...@developer.gserviceaccount.com"
access to your spreadsheet document as you grant permissions for usual
users by pressing Share.

google...@googlecode.com

unread,
May 27, 2015, 7:31:16 AM5/27/15
to gdata-dotnet-...@googlegroups.com

Comment #27 on issue 716 by magda.se...@gmail.com: Execution of
authentication request returned unexpected result: 404
https://code.google.com/p/google-gdata/issues/detail?id=716

Looks like this is the right direction for me as well, but now i'm getting
exception when I call Query method.



var query = new SpreadsheetQuery();
query.Title ="some title";
var feed = Service.Query(query);//<- exception

Any idea what could be wrong, or what should I do to check it out?

[XmlException: Root element is missing.]
System.Xml.XmlTextReaderImpl.Throw(Exception e) +69
System.Xml.XmlTextReaderImpl.ParseDocumentContent() +5674146
System.Xml.XmlTextReaderImpl.Read() +213
System.Xml.XmlTextReader.Read() +13
Google.GData.Client.BaseFeedParser.MoveToStartElement(XmlReader reader)
+174
Google.GData.Client.AtomFeedParser.Parse(Stream streamInput, AtomFeed
feed) +117

[ClientFeedException: Parsing failed]
Google.GData.Client.AtomFeedParser.Parse(Stream streamInput, AtomFeed
feed) +202
Google.GData.Client.AtomFeed.Parse(Stream stream, AlternativeFormat
format) +273
Google.GData.Client.Service.CreateAndParseFeed(Stream inputStream, Uri
uriToUse) +207
Google.GData.Client.Service.Query(FeedQuery feedQuery) +417
Google.GData.Spreadsheets.SpreadsheetsService.Query(SpreadsheetQuery
feedQuery) +42
ECosmetorium.Web.BLL.ManagerSpreadsheet.GetSpreadSheet(String url) in
c:\Users\Administrator\Source\Workspaces\Clip -
Prototype\ECosmetorium.Web\BLL\ManagerSpreadsheet.cs:1104
ECosmetorium.Web.BLL.ManagerSpreadsheet.GetListFeed(String
spreadsheetUrl, String worksheetname) in
c:\Users\Administrator\Source\Workspaces\Clip -
Prototyp\BLL\ManagerSpreadsheet.cs:902
ECosmetorium.Web.BLL.ManagerSpreadsheet.LoadAllProducts() in
c:\Users\Administrator\Source\Workspaces\Clip -
Prototype\ECosmetorium.Web\BLL\ManagerSpreadsheet.cs:406
b.BLL.ManagerSpreadsheet..ctor() in
c:\Users\Administrator\Source\Workspaces\Clip -
PrototypeLL\ManagerSpreadsheet.cs:56
eb.Pages.ExportOptimaInvoices.Page_Load(Object sender, EventArgs e) in
c:\Users\Administrator\Source\WoProPages\ExportOptimaInvoices.aspx.cs:25
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender,
EventArgs e) +51
System.Web.UI.Control.OnLoad(EventArgs e) +92
System.Web.UI.Control.LoadRecursive() +54
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772

google...@googlecode.com

unread,
May 27, 2015, 10:38:40 AM5/27/15
to gdata-dotnet-...@googlegroups.com

Comment #28 on issue 716 by APUS...@gmail.com: Execution of authentication
request returned unexpected result: 404
https://code.google.com/p/google-gdata/issues/detail?id=716

thanks Kopa.

I followed all the steps you mention, i get the below
error. "<internalReason>Login Required</internalReason>"

Google.GData.Client.GDataRequestException was unhandled
HResult=-2146233088
Message=Execution of request failed:
https://www.google.com/analytics/feeds/data?max-results=10000&dimensions=ga:dimension2,ga:source,ga:medium,ga:campaign,ga:keyword,ga:date,ga:hour&end-date=2015-05-23&ids=ga:19249406&metrics=ga:sessions,ga:goalCompletionsAll,ga:goal2Completions,ga:goal3Completions,ga:goal9Completions,ga:goal10Completions,ga:goal13Completions,ga:goal14Completions&sort=ga:date,ga:hour&start-date=2015-05-22
Source=Google.GData.Client
ResponseString=<?xml version="1.0" encoding="UTF-8"?><errors
xmlns="http://schemas.google.com/g/2005"><error><domain>GData</domain><code>required</code><location
type="header">Authorization</location><internalReason>Login
Required</internalReason></error></errors>

google...@googlecode.com

unread,
May 27, 2015, 11:48:29 AM5/27/15
to gdata-dotnet-...@googlegroups.com

Comment #29 on issue 716 by isherw...@trunkclub.com: Execution of
authentication request returned unexpected result: 404
https://code.google.com/p/google-gdata/issues/detail?id=716

how do I get the dll for using Google.Apis.Auth.OAuth2? I'm trying to edit
this http://www.statslice.com/leveraging-google-docs-with-ssis to get it
working again. The change completely busted it.

google...@googlecode.com

unread,
May 27, 2015, 11:51:31 AM5/27/15
to gdata-dotnet-...@googlegroups.com

Comment #30 on issue 716 by Sherwood...@gmail.com: Execution of
authentication request returned unexpected result: 404
https://code.google.com/p/google-gdata/issues/detail?id=716

how do I get the dll for using Google.Apis.Auth.OAuth2;. I'm trying to fix
again. Any help would be great

Ashish Sharma

unread,
May 27, 2015, 1:44:35 PM5/27/15
to gdata-dotnet-...@googlegroups.com, codesite...@google.com, google...@googlecode.com

google...@googlecode.com

unread,
May 27, 2015, 1:46:20 PM5/27/15
to gdata-dotnet-...@googlegroups.com

Comment #31 on issue 716 by evilstee...@gmail.com: Execution of
authentication request returned unexpected result: 404
https://code.google.com/p/google-gdata/issues/detail?id=716

Alright, I figured it out. Step by step instructions as follows - also see
the code I provided below. FYI, this runs in .Net 3.5 and unlike the
solution offered previously there are no new dependencies. You should be up
and running in no time.

1. If you haven't yet create your OAuth 2.0 credentials - I assume you
already know how to get those but here:
a) Log into your Google developer console:
http://console.developers.google.com
b) Create a project
c) Create your credentials - use 'installed application'
d) add the APIs that you need - I think Drive API is definitely
required. I also added Drive SDK just in case.
2. Copy the code below into VS and edit the first Main() method with your
client key and secret key.
3. Run the app and copy both the new access token and the refresh token.
Put those and your remaining credentials into the second Main() method
below.
4. You now should be able to run the second Main() method (just reverse the
naming). From now on that will be all you need - there is no need to re-run
the first Main() method.

BTW, the first Main() method below was found here:
https://developers.google.com/google-apps/spreadsheets/authorize

CODE:

using System;
using Google.GData.Client;
using Google.GData.Spreadsheets;
using Google.GData.Documents;
using System.Configuration;
using System.Collections.Specialized;

namespace GoogleSpreadsheet
{
class GoogleOAutho2
{

private static String folderName = "crazy.ivan";


static void Main(string[] args)
{

////////////////////////////////////////////////////////////////////////////
// STEP 1: Configure how to perform OAuth 2.0

////////////////////////////////////////////////////////////////////////////

// TODO: Update the following information with that obtained from
// https://code.google.com/apis/console. After registering
// your application, these will be provided for you.

string CLIENT_ID = "your_client_id";

// This is the OAuth 2.0 Client Secret retrieved
// above. Be sure to store this value securely. Leaking this
// value would enable others to act on behalf of your application!
string CLIENT_SECRET = "your_secret_key"

// Space separated list of scopes for which to request access.
string SCOPE = "https://www.googleapis.com/auth/drive
https://spreadsheets.google.com/feeds https://docs.google.com/feeds";

// This is the Redirect URI for installed applications.
// If you are building a web application, you have to set your
// Redirect URI at https://code.google.com/apis/console.
string REDIRECT_URI = "urn:ietf:wg:oauth:2.0:oob";

string TOKEN_TYPE = "refresh";


////////////////////////////////////////////////////////////////////////////
// STEP 2: Set up the OAuth 2.0 object

////////////////////////////////////////////////////////////////////////////

// OAuth2Parameters holds all the parameters related to OAuth 2.0.
OAuth2Parameters parameters = new OAuth2Parameters();

// Set your OAuth 2.0 Client Id (which you can register at
// https://code.google.com/apis/console).
parameters.ClientId = CLIENT_ID;

// Set your OAuth 2.0 Client Secret, which can be obtained at
// https://code.google.com/apis/console.
parameters.ClientSecret = CLIENT_SECRET;

// Set your Redirect URI, which can be registered at
// https://code.google.com/apis/console.
parameters.RedirectUri = REDIRECT_URI;


////////////////////////////////////////////////////////////////////////////
// STEP 3: Get the Authorization URL

////////////////////////////////////////////////////////////////////////////

// Set the scope for this particular service.
parameters.Scope = SCOPE;

parameters.AccessType = "offline"; // IMPORTANT and was missing in the
original

parameters.TokenType = TOKEN_TYPE; // IMPORTANT and was missing in the
original


// Get the authorization url. The user of your application must visit
// this url in order to authorize with Google. If you are building a
// browser-based application, you can redirect the user to the
authorization
// url.
string authorizationUrl =
OAuthUtil.CreateOAuth2AuthorizationUrl(parameters);
Console.WriteLine(authorizationUrl);
Console.WriteLine("Please visit the URL above to authorize your OAuth "
+ "request token. Once that is complete, type in your access code to "
+ "continue...");
parameters.AccessCode = Console.ReadLine();


////////////////////////////////////////////////////////////////////////////
// STEP 4: Get the Access Token

////////////////////////////////////////////////////////////////////////////

// Once the user authorizes with Google, the request token can be
exchanged
// for a long-lived access token. If you are building a browser-based
// application, you should parse the incoming request token from the url
and
// set it in OAuthParameters before calling GetAccessToken().
OAuthUtil.GetAccessToken(parameters);
string accessToken = parameters.AccessToken;
string refreshToken = parameters.RefreshToken;
Console.WriteLine("OAuth Access Token: " + accessToken + "\n");
Console.WriteLine("OAuth Refresh Token: " + refreshToken + "\n");


////////////////////////////////////////////////////////////////////////////
// STEP 5: Make an OAuth authorized request to Google

////////////////////////////////////////////////////////////////////////////

// Initialize the variables needed to make the request
GOAuth2RequestFactory requestFactory =
new GOAuth2RequestFactory(null, "MySpreadsheetIntegration-v1",
parameters);
SpreadsheetsService service = new
SpreadsheetsService("MySpreadsheetIntegration-v1");
service.RequestFactory = requestFactory;

// Make the request to Google
// See other portions of this guide for code to put here...

// Instantiate a SpreadsheetQuery object to retrieve spreadsheets.
Google.GData.Spreadsheets.SpreadsheetQuery query = new
Google.GData.Spreadsheets.SpreadsheetQuery();

// Make a request to the API and get all spreadsheets.
SpreadsheetFeed feed = service.Query(query);

// Iterate through all of the spreadsheets returned
foreach (SpreadsheetEntry entry in feed.Entries)
{
// Print the title of this spreadsheet to the screen
Console.WriteLine(entry.Title.Text);
}
Console.ReadLine();

}


// once you copied your access and refresh tokens
// then you can run this method directly from now on...
static void MainX(string[] args)
{
GOAuth2RequestFactory requestFactory = RefreshAuthenticate();

SpreadsheetsService service = new
SpreadsheetsService("MySpreadsheetIntegration-v1");
service.RequestFactory = requestFactory;

// Instantiate a SpreadsheetQuery object to retrieve spreadsheets.
Google.GData.Spreadsheets.SpreadsheetQuery query = new
Google.GData.Spreadsheets.SpreadsheetQuery();

// Make a request to the API and get all spreadsheets.
SpreadsheetFeed feed = service.Query(query);

// Iterate through all of the spreadsheets returned
foreach (SpreadsheetEntry entry in feed.Entries)
{
// Print the title of this spreadsheet to the screen
Console.WriteLine(entry.Title.Text);
}
Console.ReadLine();



public static GOAuth2RequestFactory RefreshAuthenticate() {
OAuth2Parameters parameters = new OAuth2Parameters(){
RefreshToken
= "the_refresh_token_you_copied_from_the_CLI_running_the_first_method";
AccessToken
= "the_access_token_you_copied_from_the_CLI_running_the_first_method";
ClientId = "your_client_id";
ClientSecret = "your_dirty_little_secret";
Scope = "https://www.googleapis.com/auth/drive
https://spreadsheets.google.com/feeds",
AccessType = "offline",
TokenType = "refresh"
};
string authUrl = OAuthUtil.CreateOAuth2AuthorizationUrl(parameters);
return new GOAuth2RequestFactory(null, "evilspeculator", parameters);
}
}
}

Hope that works for you guys - best of luck!

google...@googlecode.com

unread,
May 27, 2015, 11:21:22 PM5/27/15
to gdata-dotnet-...@googlegroups.com

Comment #32 on issue 716 by fernando...@gmail.com: Execution of
authentication request returned unexpected result: 404
https://code.google.com/p/google-gdata/issues/detail?id=716

I get same issue with this code. Anybody has a fix?... please


Dim gkey As String = "?key=" & PublicAPIkey


Dim dataFeedUrl As String
= "https://www.google.com/analytics/feeds/data" + gkey
Dim service As Google.GData.Analytics.AnalyticsService = New
Google.GData.Analytics.AnalyticsService("All Web Site Data")
service.setUserCredentials(username, pass)



Dim query1 As DataQuery = New DataQuery(dataFeedUrl)

query1.Ids = "ga:99999999"
query1.Metrics = "ga:users"


query1.GAStartDate = DateTime.Now.ToString("yyyy-MM-dd")
query1.GAEndDate = DateTime.Now.ToString("yyyy-MM-dd")
query1.StartIndex = 1

Dim dataFeedVisits As DataFeed = service.Query(query1)

For Each entry As DataEntry In dataFeedVisits.Entries

Dim st As String = entry.Title.Text
Dim ss As String = entry.Metrics(0).Value
visits = ss
Next

google...@googlecode.com

unread,
May 28, 2015, 12:26:59 AM5/28/15
to gdata-dotnet-...@googlegroups.com

Comment #33 on issue 716 by it-produ...@cantaloupesys.com: Execution of
authentication request returned unexpected result: 404
https://code.google.com/p/google-gdata/issues/detail?id=716

I posted detailed steps with the screenshots on Stackoverflow to lay out
the solution that worked for me.

http://stackoverflow.com/a/30497154/732945

Ashish Sharma

unread,
May 28, 2015, 5:17:21 AM5/28/15