From 80b59fc13c878a9cfe69912d7f65981813cd8f87 Mon Sep 17 00:00:00 2001 From: Christ Date: Tue, 21 Mar 2023 14:41:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20bug=2058-63=20scope=E5=9C=A8=E5=BE=AE?= =?UTF-8?q?=E8=BD=AF=E6=9C=80=E6=96=B0=E7=9A=84=E6=96=87=E6=A1=A3=E4=B8=AD?= =?UTF-8?q?=E8=A6=81=E6=B1=82=E5=BF=85=E9=A1=BB=E7=94=A8=E7=A9=BA=E6=A0=BC?= =?UTF-8?q?=E9=9A=94=E5=BC=80,form=E6=9E=84=E5=BB=BA=E6=97=B6=E5=80=99?= =?UTF-8?q?=E7=A9=BA=E6=A0=BC=E4=BC=9A=E8=A2=AB=E5=BC=BA=E5=88=B6=E8=BD=AC?= =?UTF-8?q?=E6=8D=A2=E4=B8=BA%20,=E6=89=80=E4=BB=A5=E6=AD=A4=E5=A4=84?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E8=A6=86=E7=9B=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../zhyd/oauth/request/AbstractAuthMicrosoftRequest.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/me/zhyd/oauth/request/AbstractAuthMicrosoftRequest.java b/src/main/java/me/zhyd/oauth/request/AbstractAuthMicrosoftRequest.java index 2195d5e6..2bf74aea 100644 --- a/src/main/java/me/zhyd/oauth/request/AbstractAuthMicrosoftRequest.java +++ b/src/main/java/me/zhyd/oauth/request/AbstractAuthMicrosoftRequest.java @@ -53,6 +53,13 @@ private AuthToken getToken(String accessTokenUrl) { Map form = MapUtil.parseStringToMap(accessTokenUrl, false); + //scope在微软最新的文档中要求必须用空格隔开,form构建时候空格会被强制转换为%20,所以此处重新覆盖 + String scope = form.get("scope"); + if (scope != null){ + String replace = scope.replaceAll("%20"," "); + form.put("scope",replace); + } + String response = new HttpUtils(config.getHttpConfig()).post(accessTokenUrl, form, httpHeader, false).getBody(); JSONObject accessTokenObject = JSONObject.parseObject(response);