Google Apps电子邮件迁移API是否支持2条腿的oAuth? [英] Does Google Apps Email Migration API support 2 legged oAuth?

查看:80
本文介绍了Google Apps电子邮件迁移API是否支持2条腿的oAuth?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Google Apps电子邮件迁移API开发winform应用程序.我也想使用2条腿的oAuth.

I am trying to develop winform application using Google Apps Email migration API. I also want to use 2 legged oAuth.

我已成功将2条腿式oAuth与通讯录数据API结合使用.为此,我在管理客户端API访问权限"页面上设置了API范围"http(s)://www.google.com/m8/feeds/". (http://www.google.com/support/a/bin/answer.py?hl=zh_CN&answer=162106)

I have successfully used 2 legged oAuth with contacts data API. To do this i have set the API scope "http(s)://www.google.com/m8/feeds/" on "Manage client API access" page. (http://www.google.com/support/a/bin/answer.py?hl=en&answer=162106)

对于电子邮件迁移API",我将范围设置为"https://apps-apis.google.com/a/feeds/migration".但是我收到"401:未经授权的访问"错误.

For Email Migration Api I set the scope as "https://apps-apis.google.com/a/feeds/migration". But I am getting "401: UnAuthorized access" error.

我的代码是这样的:

            GOAuthRequestFactory requestFactory = new GOAuthRequestFactory("MailItemService", "company-application-v1");
            requestFactory.ConsumerKey = "domainname";
            requestFactory.ConsumerSecret = "consumersecret";

            MailItemService mailItemService = new MailItemService("domainname", "company-application-v1");
            mailItemService.RequestFactory = requestFactory;
            MailItemEntry entry = new MailItemEntry();
            entry.Rfc822Msg = new Rfc822MsgElement(rfcTextOfMessage);

            entry.MailItemProperties.Add(MailItemPropertyElement.STARRED);
            entry.MailItemProperties.Add(MailItemPropertyElement.UNREAD);
            entry.MailItemProperties.Add(MailItemPropertyElement.INBOX);
            entry.Labels.Add(new LabelElement("Friends"));
            entry.Labels.Add(new LabelElement("Event Invitations"));
            entry.BatchData = new GDataBatchEntryData();
            entry.BatchData.Id = "0";
            MailItemEntry[] entries = new MailItemEntry[1];
            entries[0] = entry;
            MailItemFeed feed = mailItemService.Batch("domainname", user, entries);

我们如何通过电子邮件迁移API实施2条腿的oAuth.

How can we implement 2 legged oAuth with email migration API.

谢谢!

推荐答案

范围是:

https://apps-apis.google.com/a/feeds/migration/

您错过了代码中的最后一个/.另外,如果您使用的是Google Apps域的主OAuth密钥(密钥是主域),但要迁移到辅助域用户,则需要手动授予对所有域的OAuth主密钥访问权限,或者设置第三方OAuth客户端. Google的Exchange迁移工具的管理指南介绍了该工具的配置方式:

your missing the last / in your code. Also, if you're using the Google Apps domain's primary OAuth key (the key is the primary domain) but you're migrating to a secondary domain user, you'll need to either manually grant the primary OAuth key access to all domains or setup a 3rd party OAuth client. The Admin guide for Google's Exchange migration tool covers how this is configured:

查看全文

相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆