如何使用OAuthParameters创建Google DriveService的对象

时间:2013-03-01 11:45:59

标签: google-drive-api

我可以使用oAuth授权我的应用程序(我获得了访问令牌和秘密作为回报)。我使用它们来实例化OauthParameter的对象。我的问题是,我在身份验证期间添加了“google drive”的范围。如何创建DriveService的对象,就像创建PicasaService的方式一样。

PicasaService service;
GOAuthRequestFactory requestFactory;
string Picasa_CONSUMER_KEY = "<CONSUMER KEY>";
static string Picasa_CONSUMER_SECRET = "<CONSUMER SECRET>";
public static string Picasa_SCOPE = "http://picasaweb.google.com/data/https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/drive.file https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile";
string Picasa_CALLBACK_URL = "<CALLBACK URL>";

这就是我创建PicasaService对象的方法

OAuthParameters parameters = new OAuthParameters()
            {
                ConsumerKey = Picasa_CONSUMER_KEY,
                ConsumerSecret = Picasa_CONSUMER_SECRET,
                Token = "token received during authentication", 
                TokenSecret = "secret received during authentication"
            };

requestFactory = new GOAuthRequestFactory("XYZ", "XYZ APP", parameters);
service = new PicasaService(requestFactory.ApplicationName);
service.RequestFactory = requestFactory;

现在我如何“参数”来实例化DriveService的对象? 由于我已经拥有Google云端硬盘的范围,并且在身份验证过程中收到了令牌,秘密,我不想单独为Google云端硬盘做oAuth。

由于 Sujit

0 个答案:

没有答案