【发布时间】:2018-03-15 07:29:22
【问题描述】:
对于这个特定的任务,我决定最好使用 Reddit API。查看可用的不同包装器,我选择使用snoowrap。例子很清楚,我想用这样的东西来通过身份验证:
const snoowrap = require('snoowrap');
const otherRequester = new snoowrap({
userAgent: 'put your user-agent string here',
clientId: 'put your client id here',
clientSecret: 'put your client secret here',
username: 'put your username here',
password: 'put your password here'
});
我可以在Reddit Apps (Preferences Section)上找到clientID和clientSecret等重要信息。让我感到困惑的是userAgent 输入。我到底应该在这里输入什么?
我想我可以转到同一用户创建的Reddit OAuth Helper。但是,在该过程结束时,我似乎收到了 Reddit 错误请求。
【问题讨论】:
-
对于
userAgent,您需要在其中放置一个用户代理字符串。 -
我的用户代理字符串到底是什么,我在哪里可以找到它? @SvenWritesCode
-
我真的不是要粗鲁,但如果你用谷歌搜索“我的用户代理字符串到底是什么”,标题为
What's My User Agent? - User Agent & Browser Tools的第一个网站会告诉你。 -
@SvenWritesCode 是的,我看过了,但那是我的机器特有的,我希望它适用于所有机器。
标签: javascript oauth reddit