Google drive api 如何使用OAuthParameters创建GoogleDriveService的对象
我可以使用oAuth授权我的应用程序(作为回报,我可以获得访问令牌和密码)。我使用它们来实例化OauthParameter的对象。我的问题是,我在身份验证期间添加了“google drive”的作用域。如何创建DriveService的对象,就像创建PicasService一样Google drive api 如何使用OAuthParameters创建GoogleDriveService的对象,google-drive-api,Google Drive Api,我可以使用oAuth授权我的应用程序(作为回报,我可以获得访问令牌和密码)。我使用它们来实例化OauthParameter的对象。我的问题是,我在身份验证期间添加了“google drive”的作用域。如何创建DriveService的对象,就像创建PicasService一样 PicasaService service; GOAuthRequestFactory requestFactory; string Picasa_CONSUMER_KEY = "<CONSUMER KEY>
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>";
现在我如何“参数”来实例化DriveService的对象??
由于我已经拥有Google Drive的作用域,并且在身份验证过程中收到了token、secret,所以我不想单独为Google Drive执行oAuth
谢谢
苏吉特
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;