我正在尝试通过http登录Freelancer.com web api,但无法通过身份验证。这是一个用java编写的桌面应用程序,我可以从prompt运行,所以没什么特别的,但我似乎无法通过该过程的第一步,即接收授权响应。
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中如何将授权代码重定向回我的程序?
发布于 2017-12-11 10:07:47
最后还是到了那里。为他人谋取利益;
在从桌面运行的典型独立应用程序中,正确的授权类型应该是客户端凭据授权类型。
通过使用客户端凭据流,您的应用程序将为该应用程序的所有者生成一个OAuth访问令牌。因此,如果您的应用程序只需要作为该应用程序的所有者进行身份验证,那么您可以使用client credentials授予类型。
https://stackoverflow.com/questions/47726773
复制相似问题