【问题标题】:Google Contacts API asp.net settings and authorization tokenGoogle Contacts API asp.net 设置和授权令牌
【发布时间】:2012-05-06 02:47:59
【问题描述】:

有没有很好的例子来说明如何填充应用程序设置来创建请求设置?

这是来自google的代码

using Google.Contacts;
using Google.GData.Contacts;
using Google.GData.Client;
using Google.GData.Extensions;
// ...
    RequestSettings settings = new RequestSettings("<var>YOUR_APPLICATION_NAME</var>");
    // Add authorization token.
    // 
    // ...
    ContactsRequest cr = new ContactsRequest(settings);

我是否必须指定我从 oAuth 请求中获得的令牌,而不是更多?

YOUR_APPLICATION_NAME 的值可以是任何字符串值吗?

【问题讨论】:

  • 任何带有完整源代码示例的最终解决方案?也许在 github 或 codeplex 中

标签: c# asp.net oauth google-api


【解决方案1】:

如果您想使用 OAuth 2.0,您必须将 settings.OAuth2Parameters 设置为 OAuth2Parameters 类的实例或使用 RequestSettings(string applicationName, OAuth2Parameters parameters) 构造函数。

http://code.google.com/p/google-gdata/source/browse/trunk/clients/cs/samples/oauth2_sample/oauth2demo.cs 的示例应用程序展示了如何实例化 OAuth2Parameters 对象。

其他 RequestSettings 构造函数允许您使用 OAuth 1.0 和其他身份验证机制。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-09-15
    • 2012-04-04
    • 2016-10-13
    • 2015-04-13
    • 2014-12-04
    • 2012-02-12
    • 2016-11-18
    • 1970-01-01
    相关资源
    最近更新 更多