1

I am trying to integrate Google Drive service to my .Net(4.0) web application (my first time) .But I am getting redirect mismatch error when i try to run in local system.

I have created a Google OAuth 2.0 ClientID and secret in Google Developer console.

My redirect 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",
            });

0 Answers0