Force Google’s ClientLogin to Require a CAPTCHA

I’ve been working with Google’s Account Authentication API lately. Specifically working with ClientLogin. One problem I ran into is that ClientLogin says that it may return a response of 403 with an error of “CaptchaRequired”. When that happens you’re supposed to display the provided CAPTCHA image to the user and have them give the answer. This is all fine and good, but Google doesn’t provide a way for you to force this CAPTCHA requirement. To work around this I wrote a quick Ruby script so I can say:

GoogleAuth.setup_captcha("some@email.com")

After that runs, the next time I try ClientLogin with that email address it’s almost guaranteed that the CAPTCHA requirement will happen.

The script is available at http://gist.github.com/11820

As you can see, the script just hammers away trying to log into the given account until Google returns with the CaptchaRequired response.

No this isn’t nice or pretty. Ideally Google would let us pass a parameter that would force the CAPTCHA requirement to happen. Until then, this works.

One Response to “Force Google’s ClientLogin to Require a CAPTCHA”

  1. Khan Says:

    I too exhausted myself looking through the API for a way to “cleanly” solicit a CAPTCHA response to test/debug my application’s own flow in such a circumstance. But found nothing. I guess if they had provided such an API, it would become the target of abuse.

    Till then cheers to hammering. Thanks

Leave a Reply


© 2006-2009 roobasoft, LLC