2016-08-01 6 views
0

私はフリップカート出品者のAPIに登録されてフリップカート売り手APIにアクセスしようとしています - 開発者の管理ポータルをドキュメントに与えられた手順に従って、: -フリップカート売り手APIアクセストークン生成問題

https://seller.flipkart.com/api-docs/FMSAPI.html

Flipkartに登録した後、私はアクセストークンの生成に使用される最初のAPIをヒットしますが、私のコードでこのAPIをヒットすると、応答としてログインページhtmlが返されます。私はまた、手順に従って、郵便配達を経由して、これをヒットしようとした: -

1)Type of request i tried with both (GET,POST) 
2)Set appid and app-secret in the header 
3)Use the following url:- 
https://api.flipkart.net/oauth-service/oauth/token\?grant_type\=client_credentials\&scope=Seller_Api 

次の応答は、私が手に: - 私はまた、サンドボックス、彼らが提供されたURLが、両方のケースで同じ応答を試みた

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
    <head> 
     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
     <title>Flipkart</title> 
     <link type="text/css" rel="stylesheet" 
    href="./style.css" /> 
     <link type="text/css" rel="stylesheet" 
     href="./bootstrap.css" /> 
    </head> 
    <body> 
     <div class="navbar navbar-default navbar-static-top" role="navigation"> 
      <div class="container"> 
       <div class="navbar-header"> 
        <a class="navbar-brand" href="#">Flipkart Permission Registration</a> 
       </div> 
      </div> 
     </div> 
     <div class="container"> 
      <form id="loginForm" name="loginForm" role="form" class="form-signin" action="login.do" method="post"> 
       <h2 class="form-signin-heading">Please sign in </h2> 
       <input type="email" class="form-control" placeholder="Email address" 
      name='j_username' required="" autofocus=""> 
       <input type="password" name='j_password' class="form-control" 
      placeholder="Password" required=""> 
       <button class="btn btn-lg btn-primary btn-block" type="submit" name="login">Sign in</button> 
       <input type="hidden" name="CSRFToken" value="987f582b-9a4e-4c6c-a14b-681f2b57ca34"></input> 
      </form> 
     </div> 
    </body> 
</html> 

私はこの問題をグーグル、私はあなたのようなURLを変更する必要があることをどこかで見たよう: - 私もこれにしようとしたが、これのように応答を返します

https://api.flipkart.net/oauth-service/oauth/token?grant_type=client_credentials&scope=Seller_Api 

: -

{ 
    "error": "unauthorized", 
    "error_description": "An Authentication object was not found in the SecurityContext" 
} 

だから私はflipkart売り手APIのためのアクセストークンを得ることができません。助けてください 助けていただければ幸いです ありがとう!

+0

ヘッダーにappidとapp-secretを設定していますか? – TheGeorgeous

答えて

0

あなたのフリップカートのAppIDとのAppIDを置き換えることによって、ブラウザで次のURLを使用してAUTHCODEを取得できます。https://api.flipkart.net/oauth-service/oauth/authorize?client_id=appId&grant_type=authorization_code&response_type=code&scope=Seller_Api&state=1234

あなたがAUTHCODEを得れば、curlコマンドを使用して、あなたがAPPID、appSecretKeyとAUTHCODEを提供することにより、アクセストークンを取得することができます:curl -u appId:appSecretKey https://api.flipkart.net/oauth-service/oauth/token \?grant_type = authorization_code \ & state = 1234 \ & code = authCode

関連する問題