1

I am trying to access the flip-kart seller API as i registered with Flipkart seller APIs - Developer Admin portal by following steps as given in the documentation:-

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

After successfully registered with Flipkart as i hit the first API that is used for generate the access token, but as i hit this API via my code it will return me the login page html as response. I also tried to hit this via postman by following steps:-

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

The following response i get:-

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

i also tried with the sandbox URL they provided but same response on both cases.

As i google this issue i found somewhere that you need to change the URL like:-

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

i also tried with this but this will return the response as:-

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

So finally i am unable to get access-token for flipkart seller API. Please help me Any help would be appreciated Thanks!

Parveen yadav
  • 2,252
  • 1
  • 21
  • 35

1 Answers1

0

You can get authCode using the following url in a browser by replacing appId with your flipkart appId: https://api.flipkart.net/oauth-service/oauth/authorize?client_id=appId&grant_type=authorization_code&response_type=code&scope=Seller_Api&state=1234

Once you get the authCode, using curl command you can get the access token by providing appId, appSecretKey and authCode: curl -u appId:appSecretKey https://api.flipkart.net/oauth-service/oauth/token\?grant_type=authorization_code\&state=1234\&code=authCode

sadhna
  • 486
  • 1
  • 5
  • 9