S P Sharan
S P Sharan

Reputation: 1158

Using reCaptchaV3 token generated by PyPasser still results in authentication errors

I'm trying to authenticate with a website using Python's requests library, and the site uses reCAPTCHA v3 for login. I attempted to use the pypasser library to generate a valid reCAPTCHA token, but I keep receiving a 401 Unauthorized error when making the POST request.

Here’s my code:

import requests
from pypasser import reCaptchaV3

headers = {
    "Accept": "application/json, text/plain, */*",
    "Accept-Language": "en-US,en;q=0.9",
    "Authorization": "",
    "Connection": "keep-alive",
    "Content-Type": "application/json;charset=UTF-8",
    "DNT": "1",
    "Origin": "https://public.txdpsscheduler.com",
    "Referer": "https://public.txdpsscheduler.com/",
    "Sec-Fetch-Dest": "empty",
    "Sec-Fetch-Mode": "cors",
    "Sec-Fetch-Site": "same-site",
    "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36",
    "sec-ch-ua": '"Google Chrome";v="129", "Not=A?Brand";v="8", "Chromium";v="129"',
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": '"macOS"',
}


reCaptcha_response = reCaptchaV3(
    "https://www.google.com/recaptcha/enterprise/anchor?ar=1&k=6LesF7oaAAAAAEvJD0hjmTUib8Q5PGjTo54U2ieP&co=aHR0cHM6Ly9wdWJsaWMudHhkcHNzY2hlZHVsZXIuY29tOjQ0Mw..&hl=en&v=EGbODne6buzpTnWrrBprcfAY&size=invisible&cb=n3itz0yfg7ny"
)

json_data = {
    "UserName": "username",
    "RecaptchaToken": {"Action": "login", "Token": reCaptcha_response},
}

response = requests.post("https://apptapi.txdpsscheduler.com/api/auth", headers=headers, json=json_data, verify=False)

print(response.json())

This is the website I'm trying to login into: https://public.txdpsscheduler.com

Despite successfully generating a token using pypasser, I keep getting a 401 response from the server.

Upvotes: -2

Views: 196

Answers (1)

MagDev
MagDev

Reputation: 516

enter image description here Please check pypassser source. recaptchaV3 is updated a lot, so it is impossible to bypass with this library. Simple method is to use third party service or to build own captcha harvester.

Upvotes: 0

Related Questions