Tutorial - Retrieving Access Token ================================== Assume that Seller Co.1 have registered a third-party app to at https://api.flipkart.net/oauth­service/ using the Authorization Code Flow and Seller Co.2 have registered their app using the Client Credentials Flow to call the Listing API. Usecase 1: Authorization Code Flow ---------------------------------- *Seller Co.1* is redirected to the flipkart OAuth page passing ``client_id``, ``redirect uri``, ``scope``, and ``state variable``. :: https://api.flipkart.net/oauth­service/oauth/authorize?client_id=36a17224a4b418012931aa583b37540048a9&redirect_uri=http://www.bing.com/&response_type=code& scope=Seller_Api&state=1234 A Flipkart Permission Registration page is displayed. *Seller Co.1* logs in using their seller.flipkart.com credentials. An authorization dialog, **Request for Authorization** is displayed. *Seller Co.1* clicks **Allow**. The application is now redirected to the redirect URI passing a temporary authcode and state variable. To exchange the authcode with the access token: **Request** :: 6Fq8i0 curl ­-u 36a17224a4b418012931aa583b37540048a9:38b2a79736908ca9cbae9f1ed64e7fa3dhttps://api.flipkart.net/oauth­service/oauth/token\?redirect_uri\=http://www.bing.com/\&grant_type\=authorization_code\&state\=1234\&code\=lGi0D9 **Response** :: {"access_token":"f638949a­c979­4172­b33c­23311a168647","token_type":"bearer","refresh_token":"860e03da­d58a­4988­9149­a4a7f365bba1","expires_in":5183999,"scope":"DefaultSeller_Api","refresh_token_expires_in": 10703805}% Usecase 2: Client Credentials Flow ---------------------------------- *Seller Co.2* wants to access API resources they own. They write a JSON code to make a CURL call to get the access tokens. They pass multiple scopes as comma separated values. :: curl ­-u 36a17224a4b418012931aa583b37540048a9:38b2a79736908ca9cbae9f1ed64e7fa3dhttps://api.flipkart.net/oauth-service/oauth/token\?grant_type\=client_credentials curl ­-u 36a17224a4b418012931aa583b37540048a9:38b2a79736908ca9cbae9f1ed64e7fa3dhttps://api.flipkart.net/oauth-service/oauth/token?grant_type=client_credentials&scope=Seller_Api curl ­-u 36a17224a4b418012931aa583b37540048a9:38b2a79736908ca9cbae9f1ed64e7fa3dhttps://api.flipkart.net/oauth­service:16200/oauth­service/oauth/token/?grant_type=client_credentials&scope=Seller_Api,Default .. todo:: Need JSON code to make a CURL call to get access tokens. Making a Listing API Call ------------------------- Pass the token in the header in the rest API call. **Request** :: curl ­-H "Authorization":"Bearer f638949a­c979­4172­b33c­23311a168647"https://api.flipkart.net/sellers/skus/listings/LSTMOBCQH5H72E9ZFHJ0OI154 **Response** :: { "listingId":"LSTMOBCQH5H72E9ZFHJ0OI154", "skuId":"SKU0000000000000", "attributeValues": { "mrp":"4643.00", "stock_count":"2147483647", "procurement_sla":"1", "listing_status":"ACTIVE", "national_shipping_charge":"0.00", "selling_price":"2699.00", "zonal_shipping_charge":"0.00", "local_shipping_charge":"0.00" } }