我想设置一个从flipkart获取令牌的头。我不知道如何设置卷发头。我的头应该喜欢
curl -u <appid>:<app-secret> https://sandbox-api.flipkart.net/oauth-service/oauth/token\?grant_type\=client_credentials\&scope=Seller_Api发布于 2016-03-15 04:56:38
看起来,您正在尝试进行HTTP身份验证,或者至少在像这样单独使用时,curl的-u选项就是这么做的。
在PHP中,假设$ch是您的curl实例(您可以通过curl_init获得),您将为这样的curl请求设置基本身份验证:
curl_setopt($ch, CURLOPT_USERPWD, 'appid:appsecret');有关更多信息,请参见curl_setopt。
发布于 2016-04-21 10:48:05
在卷曲命令中你必须这样做,
curl -u your-app-id:your-app-token https://sandbox-api.flipkart.net/oauth-service/oauth/token\?grant_type\=client_credentials\&scope=Seller_Api你一成功就会得到这样的结果,
{"access_token":"394b7d-418a-43f6-8fd5-e67aea2c4b","token_type":"bearer","expires_in":4657653,"scope":"Seller_Api"}通过使用此令牌,您可以进行进一步的api调用,例如清单api,
curl -H "Authorization:Bearer your-access-token" -H "Content-Type: application/json" -d 'json-here-see-format-in-api-example' https://url-end-point-refer-api-docs注意:您必须在"https://sandbox-api.flipkart.net/oauth-register/login“中为沙箱创建应用程序id和机密。不要存储访问令牌,它将在一定时间内过期。
api doc的链接- "index.html“
https://stackoverflow.com/questions/36002819
复制相似问题