sanvlr12 / google-api-dotnet-client

Automatically exported from code.google.com/p/google-api-dotnet-client
0 stars 0 forks source link

Need to be able to set proxy for all WebRequests made to services #133

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Target platform (e.g. Windows, Mono, Silverlight, WP7, All)?
Windows, Mono?, Silverlight?

Please describe the feature requested.

I and my users could need to override the default proxy settings when 
performing any WebRequest against any Google API (Tasks in my case). I see that 
there is a method called CreateRequest in Request.cs. I'm guessing that if we 
as consumers had an option to specify the IWebProxy object in the Proxy 
property of the returned WebRequest object of that method, we would be home 
free.

Original issue reported on code.google.com by nilsn...@gmail.com on 1 Sep 2011 at 10:41

GoogleCodeExporter commented 9 years ago
You are right, there should definitely be an easy option to specifiy this. For 
the moment you can do something like this to get the same behavior:

var auth = new OAuth2Authenticator<NativeApplicationClient>(provider, 
GetAuthorization);

// Create the service.
var proxyAuth = new DelegateAuthenticator((request) => request.Proxy = new 
WebProxy()) { PreviousAuthenticator = auth };
var service = new TasksService(proxyAuth);

Original comment by mlin...@google.com on 1 Sep 2011 at 12:18

GoogleCodeExporter commented 9 years ago
Thanks! That'll do for now.

Original comment by nilsn...@gmail.com on 1 Sep 2011 at 12:25

GoogleCodeExporter commented 9 years ago

Original comment by mlin...@google.com on 1 Sep 2011 at 5:52

GoogleCodeExporter commented 9 years ago

Original comment by asky...@google.com on 27 Oct 2011 at 4:24

GoogleCodeExporter commented 9 years ago
I have a system in production with this workaround now, but I just realized it 
doesn't work for NativeApplicationClient.RefreshToken(), and probably all 
DotNetOpenAuth-related calls. Can you confirm this? Any second workaround for 
this problem - or a more permanent fix? :)

Original comment by nilsn...@gmail.com on 29 Nov 2011 at 8:07

GoogleCodeExporter commented 9 years ago
With the recent build google-api-dotnet-client-1.2.4667 there is no such thing 
as a property named "PreviousAuthenticator" in the DelegateAuthenticator class. 
So the example:

var auth = new OAuth2Authenticator<NativeApplicationClient>(provider, 
GetAuthorization);

// Create the service.
var proxyAuth = new DelegateAuthenticator((request) => request.Proxy = new 
WebProxy()) { PreviousAuthenticator = auth };
var service = new TasksService(proxyAuth);

Will not work.

Is there a new way to set a proxy for webrequest made against Google api? 

Original comment by christia...@gmail.com on 17 Oct 2012 at 10:21

GoogleCodeExporter commented 9 years ago
Anyone ever find a solution to this issue?

Original comment by zachstef...@gmail.com on 7 Jan 2013 at 6:00

GoogleCodeExporter commented 9 years ago
Appreciate any confirmation if using a proxy is supported in the latest Google 
Analytics API version.

Original comment by itsba...@gmail.com on 9 May 2013 at 8:34

GoogleCodeExporter commented 9 years ago

Original comment by pele...@google.com on 10 May 2013 at 9:04

GoogleCodeExporter commented 9 years ago
From 1.4.0-beta our HttpClient support proxy
see  
http://msdn.microsoft.com/en-us/library/system.net.http.httpclienthandler.proxy.
aspx for more details

Original comment by pele...@google.com on 6 Sep 2013 at 6:54