我正在尝试通过 http 登录 Freelancer.com Web api,但无法通过身份验证。它适用于 java 中的桌面应用程序,我可以从提示符运行,所以没什么特别的,但我似乎无法通过过程的第 1 步,接收授权响应。
package project.monitor;
import java.io.IOException;
import org.jsoup.Connection;
import org.jsoup.Jsoup;
public class api {
public static void main(String[] args) throws IOException {
String authEndPoint = "https://accounts.freelancer.com/oauth/authorise";
String apiEndPoint = "https://freelancer.com/api";
String str = "https://accounts.freelancer.com/oauth/authorise?" + "response_type=code"
+ "&client_id=<647f4785-fe45-4182-b97a-f401e0b0d641>" + "&redirect_uri=<https://www.google.com/>"
+ "&scope=basic" + "&prompt=select_account%20consent&advanced_scopes=1%203";
String json = Jsoup.connect(str).ignoreContentType(true).execute().body();
System.out.println(json);
}
}
文档:https ://developers.freelancer.com/docs/authentication/generating-access-tokens
The first step is to redirect your user to the Freelancer.com Identity
authorise url. This redirect prompts the user to give your application
permission to access their protected resources. When a user grants
permission, they will be redirected to an endpoint on your server with an
authorization code to be used in the following steps
这是怎么做到的?如何在 Eclipse 中将授权代码重定向回我的程序?