【问题标题】:403 Error while trying to retrieve Reddit User's saved posts using JRAW尝试使用 JRAW 检索 Reddit 用户保存的帖子时出现 403 错误
【发布时间】:2018-02-03 18:56:34
【问题描述】:

我目前正在尝试使用此代码使用JRAW reddit api wrapper 获取用户保存的帖子:

val helper = App.get().accountHelper
val paginator = helper.reddit.me()
                    .history("saved")
                    .build()

val saved = paginator.next()

Context for App class

这总是导致 403 - Forbidden。我使用JRAW-Android new user example 登录并获取oauth 令牌,然后切换到用户accountHelper.switchToUser(userName),这表明该帐户已通过身份验证..

任何想法为什么我无法进行身份验证?

【问题讨论】:

    标签: android kotlin http-status-code-403 reddit


    【解决方案1】:

    没有意识到 Reddit 有 scopes。在请求 getAuthorizationUrl 时,我必须将 history 范围添加到字符串数组中

    String[] scopes = new String[]{ "read", "identity", "account", "save", "history"};
    String authUrl = helper.getAuthorizationUrl(requestRefreshToken, useMobileSite, scopes);
    

    【讨论】:

      猜你喜欢
      • 2017-01-04
      • 2013-07-04
      • 1970-01-01
      • 2016-12-17
      • 1970-01-01
      • 2013-01-29
      • 1970-01-01
      • 1970-01-01
      • 2013-04-11
      相关资源
      最近更新 更多