Google Prediction API Service Authentication in .NET

837 views Asked by At

I'm trying to build a .NET service application that would access Google's Prediction API.

This application is a service (no user interaction) so I'd like to know how it would be possible to authenticate to Google API automatically (without having it open a browser in which to log in and then press "Authorize").

What I've tried:

  • ran some of the .NET Google API samples - they all seem to require this authentication scheme that opens a browser and requires a user to click (this is called Native Application Client authentication, I believe).

  • try using Service Accounts OAuth2 authentication - this is Work In Progress. However, there's no .NET library for this; I'm currently working with the python samples and have some problems (because I'm not a Python dev).

At this point I hope I'll be able to get the python sample going and either re-write it in .NET or use it with Iron Python.

I'm interested if anyone had this kind of problem before and what was the resolution. I'm also open to non-OAuth2 (and probably deprecated) authentication solutions if OAuth2 Service Authentication isn't possible (for now) in .NET.

1

There are 1 answers

2
Marc Cohen On BEST ANSWER

I've written a sample app (in Python & Java, sorry not available in C#) which authenticates once, stores the OAuth credentials and related data on the server (Google App Engine) and from that point forward reuses those shared credentials, refreshing the access token when needed, without requiring end users to see the OAuth allow/deny dialog, or any other aspect of OAuth.

This still requires the application administrator to execute the OAuth dialog but that's a one-time event. If for some reason you want to reset the stored server credentials, the initialization step can be re-executed on demand via a special URL, however, this reset function is protected so that only the application administrator can make that request, not an end user.