Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

BAD_CAPTCHA json error message should contain captcha_id #262

Closed
bboe opened this Issue · 11 comments

5 participants

@bboe

Quite simply, the json (though not jquery) result should contain the captcha_id when a captcha is required. By captcha_id I mean the part to complete a url like the followng: http://www.reddit.com/captcha/(captcha_id).png

The use case I encountered is when trying to submit a story via the api using api_type:json. I am nicely notified that my non-existent captcha is incorrect, however, I then have to make a request to http://www.reddit.com/api/new_captcha in order to get the captcha_id. This last round trip seems unnecessary.

By BAD_CAPTCHA error I mean this one.

@bboe

This was fixed in #315. Closing issue.

@bboe bboe closed this
@khromov

How does you actually submit the valid captcha via the story submit API?

Do I need to make two calls to submit? (First one gets rejected and i get a captcha token to solve, and then sending in the answer to that captcha token in my next request?

What's the parameter name, and should the value be a simple string with the captcha solution?

There is no documentation about this on the docs for API:Submit:
https://github.com/reddit/reddit/wiki/API:-submit

@bboe

If you look on the API documentation page for submit you will see two parameters captcha and iden. Yes, the process is exactly as you described, attempt to make a submission, notice the BadCaptcha error along with the captcha identifier. Solve the captcha and re-make the request, this time adding in the two extra post parameters captcha which is a string of the solution to the captcha, and iden which is the identifier for the captcha.

Here you can view VCaptcha validator source.

@dookerdo

Just a note: the reddit api should only request a captcha when the reddit_session cookie is not included in the request.

@bboe

@dookerdo That's not true. Even logged in users have to submit captchas.

@dookerdo

According to https://github.com/reddit/reddit/wiki/API captcha should not be required if a proper cookie is supplied in the request. Perhaps the wiki is out of date.

@dookerdo

Looks like it can also request in the case of being rate limited to prevent spammers.

@bboe

You cannot submit stories to reddit anonymously so I don't think that statement was ever correct.

@khromov

@bboe Thank you for the help, it seems the API page I linked to is incomplete.

@dookerdo Captcha is also required for newly registered accounts, until they gather a certain amount of karma, according to what I have read, but it's not documented anywhere.

@satishpandey

As suggested by @bboe I tried all the steps but still getting BAD CAPTCHA error. Steps followed by me :
1. POST /api/login/satishpandey (user,pass,api_type) // collect modhash and cookie
2. POST /api/new_captcha (user, pass, api_type) // collect iden
3. POST /api/submit (uh, iden, title, url, sr, kind, api_type) // collect captcha
4. POST /api/submit (uh, iden, title, url, sr, kind, api_type, captcha_id)

In all above requests api_type=json.

Can anyone suggest what to do?

@Erok21

I have just tested this, and as of today, I am getting a captcha failure error(with ID) for a new account, but no mention of captcha for an account with about 3k/3k karma.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.