This commit is contained in:
Leo
2026-01-15 20:13:15 +08:00
parent f044417d8d
commit 2fb283c3f3
5 changed files with 18 additions and 15 deletions

View File

@@ -67,13 +67,13 @@ wps365:
# 注意:使用 /wps365-callback 路径,避免前端路由拦截
redirect-uri: https://your-domain.com/wps365-callback
# API基础地址一般不需要修改
api-base-url: https://open.wps.cn/api/v1
api-base-url: https://openapi.wps.cn/api/v1
# OAuth授权地址一般不需要修改
oauth-url: https://open.wps.cn/oauth2/v1/authorize
oauth-url: https://openapi.wps.cn/oauth2/auth
# 获取Token地址一般不需要修改
token-url: https://open.wps.cn/oauth2/v1/token
token-url: https://openapi.wps.cn/oauth2/token
# 刷新Token地址一般不需要修改
refresh-token-url: https://open.wps.cn/oauth2/v1/token
refresh-token-url: https://openapi.wps.cn/oauth2/token
```
**重要提示**

View File

@@ -17,12 +17,13 @@ wps365:
# 应用密钥AppKey- 需要在WPS365开放平台申请注意保密
app-key: 4c58bc1642e5e8fa731f75af9370496a
# 授权回调地址需要在WPS365开放平台配置授权域名
redirect-uri: https://jarvis.van333.cn/jarvis/wps365/oauth/callback
# 注意:使用 /wps365-callback 路径,避免前端路由拦截
redirect-uri: https://jarvis.van333.cn/wps365-callback
# API基础地址
api-base-url: https://open.wps.cn/api/v1
# OAuth授权地址
oauth-url: https://open.wps.cn/oauth2/v1/authorize
api-base-url: https://openapi.wps.cn/api/v1
# OAuth授权地址正确格式https://openapi.wps.cn/oauth2/auth
oauth-url: https://openapi.wps.cn/oauth2/auth
# 获取Token地址
token-url: https://open.wps.cn/oauth2/v1/token
token-url: https://openapi.wps.cn/oauth2/token
# 刷新Token地址
refresh-token-url: https://open.wps.cn/oauth2/v1/token
refresh-token-url: https://openapi.wps.cn/oauth2/token

View File

@@ -30,16 +30,16 @@ public class WPS365Config {
private String redirectUri;
/** API基础地址 */
private String apiBaseUrl = "https://open.wps.cn/api/v1";
private String apiBaseUrl = "https://openapi.wps.cn/api/v1";
/** OAuth授权地址 */
private String oauthUrl = "https://open.wps.cn/oauth2/v1/authorize";
private String oauthUrl = "https://openapi.wps.cn/oauth2/auth";
/** 获取Token地址 */
private String tokenUrl = "https://open.wps.cn/oauth2/v1/token";
private String tokenUrl = "https://openapi.wps.cn/oauth2/token";
/** 刷新Token地址 */
private String refreshTokenUrl = "https://open.wps.cn/oauth2/v1/token";
private String refreshTokenUrl = "https://openapi.wps.cn/oauth2/token";
/**
* 配置初始化后验证

View File

@@ -29,6 +29,7 @@ public class WPS365ApiServiceImpl implements IWPS365ApiService {
@Override
public JSONObject getUserInfo(String accessToken) {
try {
// WPS365用户信息API: GET /api/v1/user/info
String url = wps365Config.getApiBaseUrl() + "/user/info";
return WPS365ApiUtil.httpRequest("GET", url, accessToken, null);
} catch (Exception e) {

View File

@@ -69,7 +69,8 @@ public class WPS365OAuthServiceImpl implements IWPS365OAuthService {
}
authUrl.append("&response_type=code");
// WPS365的scope根据官方文档设置
authUrl.append("&scope=file.readwrite,user.info");
// 注意scope参数可能需要根据实际申请的权限调整
authUrl.append("&scope=file.read,ksheet.read,user.info");
// 添加state参数
if (state == null || state.trim().isEmpty()) {