Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turnstile method appears to be broken. #26

Open
LockBitSupp opened this issue May 1, 2024 · 1 comment
Open

Turnstile method appears to be broken. #26

LockBitSupp opened this issue May 1, 2024 · 1 comment

Comments

@LockBitSupp
Copy link

Hello,
When attempting to use the cloudflare turnstile method to solve standalone turnstile captchas, it seems to always return an API error on the current version of the package.

for example, take the below code.

func handleTurnstileCaptcha() {
	cap := api2captcha.CloudflareTurnstile{SiteKey: "0x4AAAAAAADnPIDROrmt1Wwj", Url: "https://account.jagex.com"}
	solver := api2captcha.NewClient("CENSORED_API_KEY")
	solution, err := solver.Send(cap.ToRequest())
	if err != nil {
		zl.ErrorErr("Failed to solve captcha: ", err)
		log.Print(err)
		log.Print(cap.ToRequest())
		log.Print(solution)
	}
	if solution != "" {
		zl.Info("Got captcha solution: " + solution)
	}
}

This will always return api2captcha.ErrApi

2024/05/01 04:05:43 api2captcha: API error
2024/05/01 04:05:43 {map[method:turnstile pageurl:account.jagex.com sitekey:0x4AAAAAAADnPIDROrmt1Wwj] map[]}

When emulating the request this code sends in a http client we can see more details on the resulting error.

POST https://api.2captcha.com/createTask
Accept: application/json

{
    "clientKey":"CENSORED_API_KEY",
    "task": {
        "type":"TurnstileTaskProxyless",
        "websiteURL":"https://account.jagex.com",
        "websiteKey":"0x4AAAAAAADnPIDROrmt1Wwj"
    }
}
---
{
  "errorId": 110,
  "errorCode": "ERROR_BAD_PARAMETERS",
  "errorDescription": "The required captcha parameters in your reques are missing or have incorrect format. Please make sure your request payload has proper format for selected task type."
}

It seems the 2captcha api is expecting additional parameters, that the CloudflareTurnstile struct does not currently contain.

@LockBitSupp
Copy link
Author

LockBitSupp commented May 1, 2024

After reading more of the documentation, api2captcha.CloudflareTurnstile lacks a large number of the required attributes for solving this captcha, resulting in APIError on attempt to solve.
The 2captcha api documentation for Turnstile has a table listing variables for the turnstile method, both required and non-required, currently the struct for cloudflare turnstile is lacking,
Useragent (required for standalone and challenge page)
Action (required for challenge page)
Data (required for challenge page)
Pagedata (required for challenge page)

Could we please see implementation into the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant