我正在尝试建立一个可以访问谷歌预测API的.NET服务应用程序。

此应用程序是服务(无用户交互),所以我想知道如何自动对Google API进行身份验证(如果没有打开要登录的浏览器,然后按“授权”) 。

我尝试了什么:

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top