我无法在ASP.NET网络应用程序中集成Google云端硬盘。它没有显示同意屏幕,用户可以输入他/她的Google凭据来授权我的应用程序。
以下是我的代码:
String CLIENT_ID = "XXXXXX";
String CLIENT_SECRET = "XXXXXX";
String APP_USER_AGENT = "<Application - Name>";
string[] scopes = new string[] { DriveService.Scope.Drive };
DriveService service=null;
try
{
var dbDataStore = new DatabaseDataStore("<DBServer>", "<DBUser>", "<Pwd>", "<DataBase>");
UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(new ClientSecrets { ClientId = CLIENT_ID, ClientSecret = CLIENT_SECRET },
scopes, Convert.ToString(Session["UserId"]), CancellationToken.None, dbDataStore).Result;
service = new DriveService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = APP_USER_AGENT,
});
}
catch (Exception ex)
{
}
答案 0 :(得分:0)