This commit is contained in:
2025-11-05 15:42:44 +08:00
parent 41f338446d
commit 1116bddbc2
3 changed files with 131 additions and 3 deletions

View File

@@ -33,7 +33,7 @@ public class TencentDocServiceImpl implements ITencentDocService {
String redirectUri = tencentDocConfig.getRedirectUri();
String oauthUrl = tencentDocConfig.getOauthUrl();
// 构建授权URL
// 构建授权URL根据腾讯文档官方文档https://docs.qq.com/open/document/app/oauth2/authorize.html
StringBuilder authUrl = new StringBuilder();
authUrl.append(oauthUrl);
authUrl.append("?client_id=").append(appId);
@@ -44,7 +44,11 @@ public class TencentDocServiceImpl implements ITencentDocService {
authUrl.append("&redirect_uri=").append(redirectUri);
}
authUrl.append("&response_type=code");
authUrl.append("&scope=file.read_write");
authUrl.append("&scope=all"); // 根据官方文档scope固定为all
// 添加state参数用于防CSRF攻击可选但建议带上
String state = java.util.UUID.randomUUID().toString();
authUrl.append("&state=").append(state);
return authUrl.toString();
}