|
|
@@ -13,6 +13,9 @@ import org.springframework.web.bind.annotation.*;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 腾讯广告OAuth授权控制器
|
|
|
@@ -86,13 +89,10 @@ public class TencentAdsAuthController {
|
|
|
@Parameter(description = "授权码,由腾讯广告平台回调时携带", required = true, example = "auth_code_example_123456")
|
|
|
@RequestParam("authorization_code") String authorizationCode,
|
|
|
@Parameter(description = "状态参数,用于校验请求合法性", example = "手机号码")
|
|
|
- @RequestParam(required = false) String state,
|
|
|
- @Parameter(description = "回调地址,必须与获取授权URL时的redirectUri一致", required = false, example = "http://your-domain.com/callback")
|
|
|
- @RequestParam("redirect_uri") String redirectUri) {
|
|
|
+ @RequestParam(required = false) String state) {
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
try {
|
|
|
- redirectUri = java.net.URLEncoder.encode(redirectUri, "UTF-8");
|
|
|
- TencentAdsAuth auth = authService.getAccessToken(authorizationCode, state, redirectUri);
|
|
|
+ TencentAdsAuth auth = authService.getAccessToken(authorizationCode, state);
|
|
|
result.put("success", true);
|
|
|
result.put("data", auth);
|
|
|
result.put("message", "授权成功,已保存token信息");
|
|
|
@@ -105,6 +105,12 @@ public class TencentAdsAuthController {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("ok")
|
|
|
+ public String oAuthOK() {
|
|
|
+ return "OK";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 手动刷新访问令牌
|
|
|
* 使用SDK的OAuth API刷新token
|