使用2腿认证上传文档

时间:2012-10-08 16:01:27

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

我正在使用 .NET Google文档列表API ,并发现自己陷入了困境。

我想使用 2 Legged OAuthentication 上传文档,因为我已在Google Marketplace中注册我的应用程序,然后将其安装到我的域中。

现在我正在使用双腿OAuthentication与谷歌中存储的数据进行交互并正常工作。

RequestSettings settings = new RequestSettings(APPLICATION_NAME, CONSUMER_KEY, CONSUMER_SECRET, currentUser, DOMAIN);

以下是我的代码无效,并提供 401未经授权的错误:

GOAuthRequestFactory requestFactory = new GOAuthRequestFactory("cl", APPLICATION_NAME);
requestFactory.ConsumerKey = CONSUMER_KEY;
requestFactory.ConsumerSecret = CONSUMER_SECRET;
DocumentsService service = new DocumentsService(APPLICATION_NAME);
service.RequestFactory = requestFactory;
service.UploadFile(fileNameWithPath, fileName, contentType, false);

0 个答案:

没有答案