无法获取/ API /登录/工作 - 的JavaScript /书签交易 [英] Can't get /api/login/ to work - JavaScript / Reddit

查看:228
本文介绍了无法获取/ API /登录/工作 - 的JavaScript /书签交易的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我跑出来的尝试......刚刚得到这个你正在做的太多了。再试一次27分钟的路程。所以我想我会来这里问。

i'm running out of attempts... just got this "you are doing that too much. try again in 27 minutes." so I thought I would come here and ask.

这是我送的要求

网址:

http://www.reddit.com/api/login/

标题:

User-Agent: "Reddit test app"

发布数据:

user=USERNAME&passwd=PASSWORD&api_type=json


把参数中的URL,而不是...奇怪的作品!我想避免这种情况,但因为它可能是不安全的传递密码的URL。


Putting the parameters in the URL instead... strangely works! I would like to avoid this though as it may not be safe to pass the password in the URL.

例如。 <$c$c>http://www.reddit.com/api/login/?user=USERNAME&passwd=PASSWORD&api_type=json

另一个问题...我怎么访问 / API / V1 / ME /

Another question... how do I access /api/v1/me/ ?

试图通过modhash作为GET / POST参数,并且还通过传递呃作为标题。他们没有工作。

Tried passing modhash as a GET/POST parameter, and also by passing "uh" as a Header. None of them work.

任何想法我做错了吗?谢谢! :)

Any ideas what I'm doing wrong? Thanks! :)

推荐答案

首先,您可以使用的https://ssl.reddit .COM 登录。这使得有关传递参数的URL不必要的一部分的关注。

First, you can use https://ssl.reddit.com for login. That makes the concern about passing parameters as part of the URL unnecessary.

二,/ API / V1 / ME /只能通过OAuth2访问具有身份的范围中。它不能被从记录在会话访问。

Second, /api/v1/me/ can only be used with OAuth2 access that has the 'identity' scope. It cannot be accessed from a logged in session.

至于为什么你的POST请求不工作,你可能有不正确的连接codeD POST数据。尝试张贴您的数据 http://httpbin.org/post ,看看你会得到预期的结果。

As to why your POST request isn't working, you probably have incorrectly encoded the POST data. Try POSTing your data to http://httpbin.org/post and see if you get the expected results back.

这篇关于无法获取/ API /登录/工作 - 的JavaScript /书签交易的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆