【问题标题】:Get the api oath access token from reddit api从 reddit api 获取 api oauth 访问令牌
【发布时间】:2021-01-10 00:30:34
【问题描述】:

我从 reddit oauth api 成功获取了代码,但是之后尝试获取访问令牌时,我得到了无效的授权(在我以 json 格式发送数据时获得 401 未授权之前)错误。我正在使用邮递员将发布请求发送到https://www.reddit.com/api/v1/access_token 这是我在邮递员中使用的标题和表单数据。我正在从邮递员的授权选项卡中发送我的客户端 ID 和密码(尝试发送标头),并使用 x-www-form-urlencoded 发送授权类型、代码和重定向 uri(尝试将它们作为表单数据和 json 发送) .在标题中,我的内容类型是 x-www-form-urlencoded。如果有人使用过 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

【问题讨论】:

    标签: javascript reactjs postman reddit reddit-access-token


    【解决方案1】:

    如果我没记错的话,你的令牌会在 3600 分钟后过期

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-05-11
      • 2021-01-08
      • 2017-06-09
      • 2012-02-12
      • 1970-01-01
      • 1970-01-01
      • 2019-03-13
      • 2023-04-05
      相关资源
      最近更新 更多