Google云端硬盘Auth2:如何修复错误400:redirect_uri_mismatch

时间:2020-06-22 19:26:02

标签: c# drive

我正在尝试对Google驱动器执行auth2请求,并且遇到了redirecturi不匹配错误。 var credential = GoogleWebAuthorizationBroker.AuthorizeAsync(新的ClientSecret等。

   how do we set the redirecturi property to have the same redirect uris has defined when setting up the app?
   It was mentioned the fix for Google Drive v2 but I am using v3 and these are not working.
   I do not see a way, in the code, to set the google drive auth redirect uri.         
   There must be away.

代码如下:

        string[] scopes = new string[] { DriveService.Scope.Drive,
                           DriveService.Scope.DriveFile,};
        var clientId = "txdjxtd.apps.googleusercontent.com";
        var clientSecret = "didididijdiikj";


        var credential = GoogleWebAuthorizationBroker.AuthorizeAsync(new ClientSecrets
        {
            ClientId = clientId,
            ClientSecret = clientSecret
        }, scopes,
        Environment.UserName, CancellationToken.None, new FileDataStore("MyAppsToken")).Result;

请让我知道。 谢谢

0 个答案:

没有答案