ayltai / Android-Lib-reCAPTCHA

[Deprecated] The reCAPTCHA Android Library provides a simple way to show a CAPTCHA as an ImageView in your Android app, helping you stop bots from abusing it. The library wraps the reCAPTCHA API.
Apache License 2.0
71 stars 27 forks source link

Server Verification Support #4

Closed calvinh8 closed 8 years ago

calvinh8 commented 8 years ago

Hi, I am trying to use this library. However, I found out there is no support for me to verify the CAPTCHA answer on my own server. What I'm trying to do is to send the API request from my server to google and get the response. But one of the parameter to pass is the challenge which your library doesn't let me achieve it. I wonder if you can please do a little modification so I can get the challenge and pass that to my server. Or do you have a suggestion for me?

ayltai commented 8 years ago

Version 1.0.1 published. Now you can call getChallenges() after calling showChallenge(String) or after OnShowChallengeListener.onChallengeShown(boolean) is called.

getChallenges() returns a map of challenges in which you can get your specific challenge mapped by the corresponding public key.

calvinh8 commented 8 years ago

Hi,

I think I need to access imageToken not the challenge, since you pass this.imageToken in the Post on line 560. I tried the String returned by the mapping getChallenges but keep failing.

ayltai commented 8 years ago

Okay, make sense. I will also add access to imageToken as it seems imageToken and challenge could be useful in some cases.

ayltai commented 8 years ago

Version 1.0.2 published. The last imageToken and challenge can be accessed through getImageToken() and getChallenge() respectively.

I changed challenge map to challenge in 1.0.2 because I found that it is not useful to store a mapping of challenges and public keys when the ImageView can only display one image at a time.