From 688dd7ef656464a5b4964ed527493452080688f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8A=E6=B5=B7=E6=98=8E=E9=A6=A8=E7=A7=91=E6=8A=80?= =?UTF-8?q?=E6=9C=89=E9=99=90=E5=85=AC=E5=8F=B8?= Date: Sat, 19 Sep 2020 22:50:25 +0800 Subject: [PATCH] Update oauth.go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OAuthURL 预留给cdn前缀,通过server地址判断onedrive类型 --- pkg/filesystem/driver/onedrive/oauth.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/filesystem/driver/onedrive/oauth.go b/pkg/filesystem/driver/onedrive/oauth.go index 28dbd9c..0e77947 100644 --- a/pkg/filesystem/driver/onedrive/oauth.go +++ b/pkg/filesystem/driver/onedrive/oauth.go @@ -32,7 +32,8 @@ func (client *Client) OAuthURL(ctx context.Context, scope []string) string { // getOAuthEndpoint 根据指定的AuthURL获取详细的认证接口地址 func (client *Client) getOAuthEndpoint() *oauthEndpoint { - base, err := url.Parse(client.Endpoints.OAuthURL) + //base, err := url.Parse(client.Endpoints.OAuthURL)//通过api地址判断oauth地址,OAuthURL地址留给cdn替换前缀 +base, err := url.Parse(client.Endpoints.EndpointURL) if err != nil { return nil } @@ -44,7 +45,7 @@ func (client *Client) getOAuthEndpoint() *oauthEndpoint { case "login.live.com": token, _ = url.Parse("https://login.live.com/oauth20_token.srf") authorize, _ = url.Parse("https://login.live.com/oauth20_authorize.srf") - case "login.chinacloudapi.cn": + case "microsoftgraph.chinacloudapi.cn": client.Endpoints.isInChina = true token, _ = url.Parse("https://login.chinacloudapi.cn/common/oauth2/v2.0/token") authorize, _ = url.Parse("https://login.chinacloudapi.cn/common/oauth2/v2.0/authorize")