Was this helpful?
How to solve reCAPTCHA v2 on Quora
Technical engineer
Introduction
Quora is one of the largest knowledge-sharing platforms, which actively uses reCAPTCHA v2 to protect registration forms, login forms, and sometimes even when reading answers after exceeding the request limit.
Since Quora is built as a modern SPA (Single Page Application) based on React, the standard approach of simply inserting a token into a hidden input field will not work here. The token must be passed strictly through the callback function expected by the site's framework.
In this guide, we will cover how to get the necessary parameters, solve the captcha via the 2Captcha API, and correctly inject the token into Quora using Python.
Task Parameters
To bypass reCAPTCHA v2 on Quora, the RecaptchaV2TaskProxyless task type is used (if you are not using your own proxies) or RecaptchaV2Task.
json
{
"clientKey": "YOUR_API_KEY",
"task": {
"type": "RecaptchaV2TaskProxyless",
"websiteURL": "https://www.quora.com/",
"websiteKey": "6Lcbz34UAAAAAL8AdJSo8BkXQ-pUMfr7OfbTZCY8"
}
}
How to find the parameters
websiteURL
This is the full address of the page where the captcha appears. For Quora, this could be the main page (https://www.quora.com/) or a specific login page (https://www.quora.com/login).
websiteKey (SiteKey)
This is the public reCAPTCHA key. On Quora, it is static, but if you are setting up automation for another site, here is how to find it:
- Open the page with the captcha and press F12 (DevTools).
- Go to the Elements tab.
- Press Ctrl+F (or Cmd+F) and type data-sitekey.
- Copy the attribute value. For Quora, it is 6Lcbz34UAAAAAL8AdJSo8BkXQ-pUMfr7OfbTZCY8.
Alternative method: Go to the Network tab, filter by Fetch/XHR, and find the request to google.com/recaptcha/anchor. In the request parameters (Query String Parameters), there will be a parameter k — this is your websiteKey.
A critically important step: Passing the token via Callback
This is the most important section for understanding how to work with Quora and other modern SPA applications.
Why the standard approach doesn't work
In classic HTML forms, reCAPTCHA v2 works like this: after solving the captcha, Google calls a callback function that writes the token to the hidden g-recaptcha-response field, and when the form is submitted, this token goes to the server.
But Quora uses React, and the form is not submitted the standard way via submit. Instead, the React component intercepts user input and sends data via JavaScript (fetch or XMLHttpRequest). If you simply insert the token into the hidden field, React won't see it because the component state won't update.
How the callback works in reCAPTCHA v2
When you initialize reCAPTCHA on a page, you specify a callback function. After solving the captcha, Google calls this function and passes the token to it. The React application updates its state, and the form submission button becomes active.
If you don't call the callback, the token will only be written to the hidden field, but React won't know about it. The button will remain inactive, and the form won't be submitted.
Detailed instructions for calling the callback
In modern applications, the callback function is stored in the global object ___grecaptcha_cfg. You need to recursively traverse this object to find the function named callback, and then call it with the received token.
Detailed instructions with code examples for finding and calling the callback: https://2captcha.com/h/recaptcha-v2-callback
Code Examples
Python + requests (Getting the token via API)
If you just need to get the token on the backend (for example, to pass it to the frontend), use this code.
python
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
from twocaptcha import TwoCaptcha
api_key = os.getenv('APIKEY_2CAPTCHA', 'YOUR_API_KEY')
solver = TwoCaptcha(api_key)
try:
result = solver.recaptcha(
sitekey='6Lcbz34UAAAAAL8AdJSo8BkXQ-pUMfr7OfbTZCY8',
url='https://www.quora.com/'
)
print(f"Token received successfully: {result['code']}")
# Here you can pass result['code'] to the frontend or use it in an API request
except Exception as e:
print(f"An error occurred: {e}")
Python + Playwright (Browser automation)
For a full bypass on Quora, we will use Playwright. This code opens a browser and solves the captcha. After receiving the token, it needs to be injected via the callback (see the instructions at the link above).
python
import asyncio
from playwright.async_api import async_playwright
from twocaptcha import TwoCaptcha
API_KEY = 'YOUR_API_KEY'
SITE_KEY = '6Lcbz34UAAAAAL8AdJSo8BkXQ-pUMfr7OfbTZCY8'
PAGE_URL = 'https://www.quora.com/login'
async def solve_captcha():
async with async_playwright() as p:
browser = await p.chromium.launch(headless=False)
page = await browser.new_page()
await page.goto(PAGE_URL)
# Wait for the captcha iframe to appear
await page.wait_for_selector('iframe[src*="recaptcha"]', timeout=10000)
# Solve the captcha via API
solver = TwoCaptcha(API_KEY)
result = solver.recaptcha(sitekey=SITE_KEY, url=PAGE_URL)
token = result['code']
print(f"Captcha solved! Token: {token}")
# Here you need to inject the token via callback
# Detailed instructions: https://2captcha.com/h/recaptcha-v2-callback
await asyncio.sleep(5) # Pause to check the result
await browser.close()
asyncio.run(solve_captcha())
Reports on solution accuracy
If the site rejected the received token, be sure to report it. This helps the service improve its algorithms and refunds your funds for the failed attempt. You can submit a report via your personal account or directly through the API.
Submitting reports via HTTP requests
The 2Captcha API provides two endpoints for submitting reports:
- https://api.2captcha.com/reportIncorrect — for incorrect solutions
- https://api.2captcha.com/reportCorrect — for correct solutions
Report for an incorrect solution (reportIncorrect)
Used if the site rejected the token or returned the captcha page again. The funds for the task will be refunded to your balance.
JSON request:
json
{
"clientKey": "YOUR_API_KEY",
"taskId": "TASK_ID_FROM_CREATE_TASK"
}
Sending via Python (requests):
python
import requests
API_KEY = "YOUR_API_KEY"
TASK_ID = "123456789"
response = requests.post(
"https://api.2captcha.com/reportIncorrect",
json={
"clientKey": API_KEY,
"taskId": TASK_ID
}
)
print(response.json())
# Expected response: {"request": "OK_REPORT_SUBMITTED", "status": "reported"}
Report for a correct solution (reportCorrect)
Used if the site accepted the token without errors. This helps the service maintain high recognition quality.
JSON request:
json
{
"clientKey": "YOUR_API_KEY",
"taskId": "TASK_ID_FROM_CREATE_TASK"
}
Sending via Python (requests):
python
import requests
API_KEY = "YOUR_API_KEY"
TASK_ID = "123456789"
response = requests.post(
"https://api.2captcha.com/reportCorrect",
json={
"clientKey": API_KEY,
"taskId": TASK_ID
}
)
print(response.json())
# Expected response: {"request": "OK_REPORT_SUBMITTED", "status": "reported"}
Detailed guide on submitting reports with examples for different languages: https://2captcha.com/h/how-to-submit-reports
Common errors and solutions
| Error / Problem | Cause | Solution |
|---|---|---|
| Token received, but Quora asks to solve the captcha again | The token was not passed via callback, or the token's lifetime has expired | Make sure you are using a JS script to call the callback (see the section above). reCAPTCHA v2 tokens live for 1-2 minutes, use them immediately |
| ERROR_WRONG_USER_KEY | Invalid API key | Check that you are using the correct key from 2Captcha |
| ERROR_ZERO_BALANCE | Insufficient funds in your balance | Top up your account in your 2Captcha personal account |
| Callback is not called, button is inactive | The structure of ___grecaptcha_cfg differs from the standard one | Manually inspect the ___grecaptcha_cfg.clients object via the browser console and adapt the function search |
Useful links
- Sandbox for testing the API: https://2captcha.com/setting#sandbox
- reCAPTCHA v2 documentation: https://2captcha.com/api-docs/recaptcha-v2
- How to pass a token via callback: https://2captcha.com/h/recaptcha-v2-callback
- Detailed guide on submitting reports: https://2captcha.com/h/how-to-submit-reports
- Library for Python: https://github.com/2captcha/2captcha-python
- Library for Node.js: https://github.com/2captcha/2captcha-javascript