我有以下参数:
$url = "https://example.com/auth_token.json"
$clientId = "...", $secretId = "..."
$callback = "http://example"
$code = "1234" - # i've received if earlier,
$body = "grant_type=authorization_code&code=$code&redirect_uri=$callback"
我的目标是通过代码获取令牌,服务说:
“向$ url发送POST请求,提供客户端ID和密钥作为HTTP基本授权凭据,以及包含grant_type = authorization_code的帖子正文 并使用令牌响应json。“
我试过这样的事情
curl $url --verbose -d $body -X -POST
但回答是 - 状态:401,未经授权和json“未经授权的客户端或身份验证失败,请检查您的凭据。”
然后我尝试添加
-H "Authorization : Basic ...encoded value..."
并获得“错误请求”
请帮帮我,我错过了什么, THX