我从 reddit OAuth API 获得了 OAuth 代码,但之后尝试获取令牌时出现 401 授权错误。我正在使用邮递员将发布请求发送到https://www.reddit.com/api/v1/access_token
这是我在 Postman 中使用的标题和 POST 正文。
//Headers
Authorization:Basic Base.Encode64(clientid:secret)
Content-Type:application/x-www-form-urlencoded
//client id and secret are those which I got by creating the app in reddit
//Body
{
"grant_type":"authorization_code",
"code":"authcode which I got from the get request before",
"redirect_uri":"http://localhost:3000"
}
//I tried sending these through query string as well