You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling scraper.login(username, password, email), the login fails immediately with a Cloudflare 403 response during the pre-flight or onboarding task request. The response body is an HTML Cloudflare block/challenge page rather than JSON, causing the library to throw "Failed to parse response body".
Login completes successfully and scraper.isLoggedIn() returns true.
Actual Behavior
ApiError is thrown with HTTP 403 and data: Failed to parse response body. The raw response is a Cloudflare HTML challenge page, not a Twitter API JSON response.
Additional Context
The Cloudflare cf-ray header is present, confirming the block is at the Cloudflare layer, before Twitter's own API is reached.
Tried the following workarounds (check any that apply):
Waiting and retrying
Using a different IP / residential proxy
Cookie-based auth via scraper.setCookies()
Enabling 2FA on the account
Question for Maintainers
Is there a supported way to handle Cloudflare JS challenges in the pre-flight step, or is cookie-based auth now the only reliable method for server-side environments?
Description
When calling
scraper.login(username, password, email), the login fails immediately with a Cloudflare 403 response during the pre-flight or onboarding task request. The response body is an HTML Cloudflare block/challenge page rather than JSON, causing the library to throw"Failed to parse response body".Error Log
Environment
x.x.xvxx.x.xcf-rayPoP code:CGK(Jakarta)Steps to Reproduce
await scraper.login(username, password, email)Expected Behavior
Login completes successfully and
scraper.isLoggedIn()returnstrue.Actual Behavior
ApiErroris thrown with HTTP 403 anddata: Failed to parse response body. The raw response is a Cloudflare HTML challenge page, not a Twitter API JSON response.Additional Context
cf-rayheader is present, confirming the block is at the Cloudflare layer, before Twitter's own API is reached.scraper.setCookies()Question for Maintainers
Is there a supported way to handle Cloudflare JS challenges in the pre-flight step, or is cookie-based auth now the only reliable method for server-side environments?