[英]Get the api oath access token from reddit api
I got the code successfully from the reddit oauth api but I am getting invalid grant(Before I was getting 401 unauthorized on sending data as json) error when trying to get the access token after that.我从 reddit oauth api 成功获得了代码,但是之后尝试获取访问令牌时,我得到了无效的授权(在我以 json 格式发送数据时获得 401 未授权之前)错误。 I am using postman for sending the post request to https://www.reddit.com/api/v1/access_token Here is My header and form data which I am using in postman.
我正在使用邮递员将发布请求发送到https://www.reddit.com/api/v1/access_token这是我在邮递员中使用的标题和表单数据。 I am sending my client id and secret in authorization tab(tried in sending header) from postman and using x-www-form-urlencoded to send grant type, code and redirect uri(tried sending them as a form data and json as well).
我正在从邮递员的授权选项卡中发送我的客户端 ID 和密码(尝试发送标头),并使用 x-www-form-urlencoded 发送授权类型、代码和重定向 uri(尝试将它们作为表单数据和 json 发送) . In headers my content type is x-www-form-urlencoded.
在标题中,我的内容类型是 x-www-form-urlencoded。 Please help in getting the token if someone have used reddit api.
如果有人使用过 reddit api,请帮助获取令牌。
//Headers
Content-Type:application/x-www-form-urlencoded
//authorization
Authorization:Basic Base.Encode64(clientid:secret)
//client id and secret are those which I got by creating the app in reddit
//x-www-form-urlencoded.
{
"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
如果我没记错的话,你的令牌会在 3600 分钟后过期
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.