2017-12-09 7 views
0

httpでFreelancer.comのWeb APIにログインしようとしていますが、認証を通過できません。それは私がプロンプトから実行できるjavaのデスクトップアプリケーションのため、何も想像していないが、私は傾きが許可応答を受け取って、プロセスの過去のステップ1を取得するようだ。OAuth 2.0 Freelancer.com APIのJavaでのHTTPによる認証

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); 

    } 

} 

ドキュメント:

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 

https://developers.freelancer.com/docs/authentication/generating-access-tokensはどのようにこれが行われていますか?私はどのように私のプログラムに認証コードをeclipseでリダイレクトするのですか?

答えて

0

最後に見つかりました。他の人の利益のために;

デスクトップから実行される一般的なスタンドアロンアプリケーションでは、正しい認可タイプはクライアント資格認可タイプです。

クライアントの資格情報フローを使用すると、アプリケーションはそのアプリケーションの所有者のOAuthアクセストークンを生成します。したがって、アプリケーションがそのアプリケーションの所有者として認証する必要がある場合は、クライアント資格情報の認可タイプを使用できます。

関連する問題