【发布时间】:2015-02-08 17:27:04
【问题描述】:
我尝试通过传递下面屏幕截图中显示的参数来使用 REST API 获取访问令牌,但我遇到了错误 Required parameter is missing: grant_type。我在 Chrome 浏览器中尝试过使用 cURL 和 Advanced Rest API。我正在使用 cURL 和高级 REST API 发送这些参数:
client_secret;xxx
refresh_token;
redirect_uri;https%3A%2F%2Fwww%2Eexample%2Ecom%2Foauth2callback
scope;https://www.googleapis.com/auth/drive
client_id;xxxxxxxx.apps.googleusercontent.com
access_token;
cURL 语法:
D:\>curl -k --header Content-Type=application/x-www-form-urlencoded -i -X POST "https://accounts.google.com/o/oauth2/token" -F 'code=4%2FdpbtMVUpzNFAfGHlxrNvfMlvHrPWk_m8y2I-thDdsLk.wvBSFgWEqW0Zcp7tdiljKKZFG-jOlgI' -F 'client_id=xxxxxxxx.apps.googleusercontent.com' -F 'client_secret=xxx' -F 'redirect_uri=https%3A%2F%2Fwww%2Eexample%2Ecom%2Foauth2callback' -F 'grant_type=authorization_code'
如何解决这个问题?
【问题讨论】:
标签: curl oauth-2.0 google-oauth google-drive-realtime-api