尝试使用 JRAW 检索 Reddit 用户保存的帖子时出现 403 错误

403 Error while trying to retrieve Reddit User's saved posts using JRAW

我目前正尝试使用 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 - 禁止访问。我登录并使用 JRAW-Android new user example 获取 oauth 令牌,然后切换到显示帐户已通过身份验证的用户 accountHelper.switchToUser(userName)..

为什么我无法验证?

没意识到 Reddit 有 scopes。请求 getAuthorizationUrl

时,我必须将 history 范围添加到字符串数组
String[] scopes = new String[]{ "read", "identity", "account", "save", "history"};
String authUrl = helper.getAuthorizationUrl(requestRefreshToken, useMobileSite, scopes);