首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在OAuth中通过HTTP2.0对Freelancer.com应用程序接口进行身份验证

在OAuth中通过HTTP2.0对Freelancer.com应用程序接口进行身份验证
EN

Stack Overflow用户
提问于 2017-12-09 16:31:03
回答 1查看 302关注 0票数 0

我正在尝试通过http登录Freelancer.com web api,但无法通过身份验证。这是一个用java编写的桌面应用程序,我可以从prompt运行,所以没什么特别的,但我似乎无法通过该过程的第一步,即接收授权响应。

代码语言:javascript
复制
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

代码语言:javascript
复制
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中如何将授权代码重定向回我的程序?

EN

回答 1

Stack Overflow用户

发布于 2017-12-11 10:07:47

最后还是到了那里。为他人谋取利益;

在从桌面运行的典型独立应用程序中,正确的授权类型应该是客户端凭据授权类型。

通过使用客户端凭据流,您的应用程序将为该应用程序的所有者生成一个OAuth访问令牌。因此,如果您的应用程序只需要作为该应用程序的所有者进行身份验证,那么您可以使用client credentials授予类型。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47726773

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档