2015-09-13 87 views
0

我在將Google雲端硬盤集成到我的ASP.NET Web應用程序時遇到問題。它沒有顯示用戶可以輸入他/她的Google憑證以授權我的應用程序的同意屏幕。集成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

你有沒有讓這個工作?很高興知道解決方案 – ganesh

回答

相關問題