我通过Postman发出了以下HTTP POST请求,以进行基本的oauth身份验证。在查看postman在幕后执行的原始curl命令时,它看起来如下所示:
curl -X POST \
https://api.twitter.com/oauth2/token \
-H 'Authorization: Basic Hdkdhfjdekrhfkhskierufh75947rhdklww==' \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Postman-Token: c1b380a7-e4b3-4269-a789-1c7271f2986a' \
-d grant_type=client_credentials
如何使用Retrofit for Java发送等效请求?注意:我正在用Eclipse编写Java程序--我不打算在Android上尝试这样做。
发布于 2018-07-30 04:20:29
你可以有一个拦截器来做basic authentication
的事情。
https://stackoverflow.com/questions/51584191
复制相似问题