Flipkart卖家API访问令牌生成问题

Flipkart卖家API访问令牌生成问题

问题描述:

我想为我Flipkart卖家的API注册访问倒装卡丁车卖家API - 通过以下步骤,如文档中给出的开发管理门户网站 -Flipkart卖家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 

下面的响应,我得到: -

<!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

你可以通过你的flipkart的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