所以我试图调用链接的 GET 请求
https://captivate.taps.com/auth/authorize?client_id=7b3fe4ba-3c3d-4fbf&redirect_uri=http://localhost:4502/ats/GetCode.html
此链接将授权 client_id 并重定向到提供的 url,并在 url 后附加一个参数“code”。
调用 GET 请求的代码是 -
HttpClient client = new HttpClient();
String url = "https://captivate.taps.com/auth/authorize?client_id=7b3fe4ba-3c3d-4fbf&redirect_uri=http://localhost:4502/ats/GetCode.html";
GetMethod getMethod = new GetMethod(url);
getMethod.setFollowRedirects(true);
int getStatus = client.executeMethod(getMethod);
重定向的 url -http://localhost:4502/ats/GetCode.html
有代码-
String authCode = request.getParameter("code");
GetAccessToken.code = authCode; // GetAccessToken is a class with a static String "code".
问题是当我使用浏览器触发链接时,会调用 GetCode.html 并分配授权代码,但是当我使用提供的代码执行相同操作时,永远不会调用 GetCode.html。
更新:我想要的只是捕获重新编辑的 url,以便我可以从中获取授权码