1

我正在尝试将 Google Drive 服务集成到我的 .Net(4.0) Web 应用程序(我的第一次)。但是当我尝试在本地系统中运行时出现重定向不匹配错误。

我在 Google Developer 控制台中创建了 Google OAuth 2.0 ClientID 和密码。

我的重定向 Uri:http://localhost:58207/oauth2callback

string[] scopes = new string[] { DriveService.Scope.Drive,
                                 DriveService.Scope.DriveFile};           
UserCredential credential =  GoogleWebAuthorizationBroker.AuthorizeAsync(new ClientSecrets
                                      {
                                          ClientId = "my client id"
                                         ,ClientSecret = "my client secret"
                                      }
                                      , scopes
                                      , Environment.UserName
                                      , CancellationToken.None ).Result;

            DriveService service = new DriveService(new BaseClientService.Initializer()
            {
                HttpClientInitializer = credential,
                ApplicationName = "Google drive Integration",
            });
4

0 回答 0