Google AuthenticatorFactory更换?

时间:2012-04-30 02:34:35

标签: c# oauth-2.0 google-calendar-api

Google Calendar API的“First App”教程在使用Google验证应用程序时使用AuthenticatorFactory。根据{{​​3}},AuthenticatorFactory已于2011年8月8日从API中删除。有人能指出我找到用Google验证我的应用程序的“新”方式吗?

编辑:刚才意识到我没有包含我正在使用的语言 - 我正在寻找有关如何验证/授权已安装的C#应用​​程序的示例。

1 个答案:

答案 0 :(得分:1)

很抱歉打开一个旧主题,但我遇到了同样的问题,我花了很长时间才找到解决方案。所以对于遇到同样问题的所有人:

AuthenticatorFactory不起作用,您需要使用以下代码创建服务:

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

// Create the service.
var service = new CalendarService(new BaseClientService.Initializer
{
     Authenticator = auth
});
祝你好运!