# Recaptcha verification failture

**URL:** <https://www.ruby-forum.com/t/recaptcha-verification-failture/192552>\
**Category:** Rails\
**Created:** [August 2, 2010, 12:26am UTC](https://www.ruby-forum.com/t/recaptcha-verification-failture/192552 "2010-08-02T00:26:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![badnaam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e36b37/32.png) [@badnaam](https://www.ruby-forum.com/u/badnaam)\
**Post date:** [August 2, 2010, 12:26am UTC](https://www.ruby-forum.com/t/recaptcha-verification-failture/192552/1 "2010-08-02T00:26:27Z")

</div>

I am using the rails ambethia-recaptcha gem

My recaptcha verification fails in production, the same code works  
just fine in development. I made sure the public and private keys are  
correct and the correct keys load in the production enviornment. My  
production server hostname is “server” (this is kinda test production  
basically a server in my home network running passenger on xubuntu)  
and I generated the keys are recaptcha with that name. Where do I even  
begin to troubleshoot this?

In config.yml

# 

test:  
recap\_pub\_key: 6LcbaboSAAAAADbBxT9yLOJ7CoLWLsuAfZr-aL-H  
recap\_priv\_key: 6LcbaboSAAAAACJMtxxfExG5dm\_GcDHuZl9WVjZG  
google\_js\_api: ABQIAAAAi\_F8JNAI9\_\_oCG-  
KzCfTYhTJQa0g3IQ9GZqIMmInSLzwtGDKaBQ6kTvHNGROiENaALqema6YZJEh2Q  
development:  
recap\_pub\_key: 6LcbaboSAAAAADbBxT9yLOJ7CoLWLsuAfZr-aL-H  
recap\_priv\_key: 6LcbaboSAAAAACJMtxxfExG5dm\_GcDHuZl9WVjZG  
google\_js\_api: ABQIAAAAi\_F8JNAI9\_\_oCG-  
KzCfTYhTJQa0g3IQ9GZqIMmInSLzwtGDKaBQ6kTvHNGROiENaALqema6YZJEh2Q  
production:  
recap\_pub\_key: 6LcbaboSAAAAADbBxT9yLOJ7CoLWLsuAfZr-aL-H  
recap\_priv\_key: 6LcbaboSAAAAACJMtxxfExG5dm\_GcDHuZl9WVjZG  
google\_js\_api: ABQIAAAAi\_F8JNAI9\_\_oCG-  
KzCfTYhTJQa0g3IQ9GZqIMmInSLzwtGDKaBQ6kTvHNGROiENaALqema6YZJEh2Q

in environment.rb

APP\_CONFIG = YAML.load\_file("#{RAILS\_ROOT}/config/config.yml")  
[RAILS\_ENV]  
ENV[‘RECAPTCHA\_PUBLIC\_KEY’] = APP\_CONFIG[‘recap\_pub\_key’]  
ENV[‘RECAPTCHA\_PRIVATE\_KEY’] = APP\_CONFIG[‘recap\_priv\_key’]  
ENV[‘GOOGLE\_JS\_API’] = APP\_CONFIG[‘google\_js\_api’]

In users\_controller.rb

# 

def create  
@user = User.new(params[:user])  
@user.role = Role.find\_by\_name(‘user’)  
v = verify\_recaptcha(:model =\> @user, :message =\> “Text  
entered did not match the image!”)  
logger.debug v.to\_s  
logger.debug @user.inspect  
logger.debug “Errors for this registration”  
logger.debug @user.errors.inspect  
if v  
if @user.save\_without\_session\_maintenance  
@user.send\_later :deliver\_activation\_instructions!  
flash[:notice] = t(‘users.create.confirmation’)

# redirect\_back\_or\_default root\_url

```
            redirect_to root_url
        else
            render :action => :new
        end
    else

```

# @user.errors.add()

# flash[:error] = “Text entered did not match the image”

```
        render :action => :new
    end
end

```

# in production.log

Recaptcha result - false  
#\<User id: nil, email: “removed\_email\_address@domain.invalid”, zip: “88888”,  
processing\_vote: false, cached\_slug: nil, username: “user1”, sex: 0,  
age: 29, lat: nil,  
lng: nil, role\_id: 2, posts\_count: 0, active: nil, created\_at: nil,  
updated\_at: nil, crypted\_password:  
“2754e9333463856a1aaa4a91e5616323866e8833fafc  
54e3029…”, password\_salt: “pdQQJpXxzqHJyNXjYO\_M”, persistence\_token:  
“7bd973e319a175a7048680850a552667f668ee859b9af137a16…”,  
single\_access\_token:  
“muJOtrpdTXPJ6cQWtZs3”, perishable\_token: nil, login\_count: 0,  
failed\_login\_count: 0, last\_request\_at: nil, current\_login\_at: nil,  
last\_login\_at: ni  
l, current\_login\_ip: nil, last\_login\_ip: nil, image\_file\_name: nil,  
image\_content\_type: nil, image\_file\_size: nil, image\_updated\_at: nil,  
processing:  
true\>  
Errors for this registration  
#\<ActiveRecord::Errors:0xb2d1044 @base=#\<User id: nil, email:  
“removed\_email\_address@domain.invalid”, zip: “94131”, processing\_post: false, cached\_slug:  
nil, userna  
me: “user1”, sex: 0, age: 29, lat: nil, lng: nil, role\_id: 2,  
posts\_count: 0, active: nil, created\_at: nil, updated\_at: nil,  
crypted\_password: “2754e  
9333463856a1aaa4a91e5616323866e8833fafc54e3029…”, password\_salt:  
“pdQQJpXxzqHJyNXjYO\_M”, persistence\_token:  
“7bd973e319a175a7048680850a552667f668ee  
859b9af137a16…”, single\_access\_token: “muJOtrpdTXPJ6cQWtZs3”,  
perishable\_token: nil, login\_count: 0, failed\_login\_count: 0,  
last\_request\_at: nil, c  
urrent\_login\_at: nil, last\_login\_at: nil, current\_login\_ip: nil,  
last\_login\_ip: nil, image\_file\_name: nil, image\_content\_type: nil,  
image\_file\_size:  
nil, image\_updated\_at: nil, processing: true\>, @errors=#\<OrderedHash  
{“base”=\>[#\<ActiveRecord::Error:0xb0b7c54 @base=#\<User id: nil, email:  
“removed\_email\_address@domain.invalid”, zip: “88888”, processing\_vote: false, cached\_slug:  
nil, username: “user1”, sex: 0, age: 29, lat: nil, lng: nil, role\_id:  
2, posts\_cou  
nt: 0, active: nil, created\_at: nil, updated\_at: nil,  
crypted\_password:  
“2754e9333463856a1aaa4a91e5616323866e8833fafc54e3029…”,  
password\_salt: “pdQ  
QJpXxzqHJyNXjYO\_M”, persistence\_token:  
“7bd973e319a175a7048680850a552667f668ee859b9af137a16…”,  
single\_access\_token: “muJOtrpdTXPJ6cQWtZs3”, perisha  
ble\_token: nil, login\_count: 0, failed\_login\_count: 0,  
last\_request\_at: nil, current\_login\_at: nil, last\_login\_at: nil,  
current\_login\_ip: nil, last\_l  
ogin\_ip: nil, image\_file\_name: nil, image\_content\_type: nil,  
image\_file\_size: nil, image\_updated\_at: nil, processing: true\>,  
@attribute=:base, @messa  
ge=“Text entered did not match the image!”, @type=“Text entered did  
not match the image!”, @options={}\>]}\>\>
