I am getting this error while running rails application and here is the complete Error
ArgumentError (A secret is required to generate an integrity hash for
cookie session data. Use config.secret_token = "some secret phrase of
at least 30 characters"in config/initializers/secret_token.rb):**
I use rvm 1.9.3 and rails 3.2.13.
Any help appreciated.
Thanks in advance.
The message is pretty straight forward. Check in the config/initializers/secret_token.rb
file for the config.secret_token
setting and configure it if it is not there.
Generate secret token using:
rake secret
It will return
=> '3eb6db5a9026c547c72708438d496d942e976b252138db7e4e0ee5edd7539457d3ed0fa02ee5e7179420ce5290462018591adaf5f42adcf855da04877827def2'
then edit your file or create new one:
# config/initializers/secret_token.rb
# Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
MyApp::Application.config.secret_token = '3eb6db5a9026c547c72708438d496d942e976b252138db7e4e0ee5edd7539457d3ed0fa02ee5e7179420ce5290462018591adaf5f42adcf855da04877827def2'
I ran into this when using the figaro gem to keep my keys secret.
application.yml will not be there if you clone the project to a new location. This is desirable behavior, because we don't want the wider internet to be able to check out all of our secret information.
If this is your issue. You will need to copy the application.yml from its original location, or generate new keys to replace the ones that were there.
Yes. The string is right:
config.secret_token = "..."
But, for me - redmine can fly after i put this string into the config/application.rb
file.