Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devise.secret_key was not set. Please add the following to your Devise initializer #235

Closed
karimbutt opened this issue May 7, 2015 · 4 comments

Comments

@karimbutt
Copy link

I am getting the following error when I try to migrate my database or run my app in production: Devise.secret_key was not set. Please add the following to your Devise initializer:

config.secret_key = 'my secret key'

When I add this secret key, I get the following error:

NoMethodError: undefined method `secret_key=' for DeviseTokenAuth:Module

I am not sure why this error keeps occurring - note this issue only occurs in production.

@vsnguyen
Copy link

vsnguyen commented Jun 7, 2015

check your config/secrets.yml file. most likely you'll need to set an environment variable for it.

troggy added a commit to troggy/devise_token_auth that referenced this issue Jul 29, 2015
@gamesover
Copy link

gamesover commented Mar 9, 2017

I have a local secrets.yml file, so locally, I have no issue. But when I push the code, travis-ci cannot pass since there is no secrets.yml at github repository. Thus, I have to create a devise.rb with setup

config.secret_key = MyApp::Application.config.secret_key_base || ENV['SECRET_KEY_BASE']

since devise_token_auth.rb does not know config.secret_key

@osazemeu
Copy link

osazemeu commented Mar 10, 2017

Set SecretKey

config/initializers/devise.rb
config.secret_key = ENV[ 'DEVISE_SECRET_KEY' ]

http://stackoverflow.com/questions/30089977/devise-token-auth-error-devise-secret-key-was-not-set

@zachfeldman
Copy link
Contributor

Seems solved. Reopen if not @karimbutt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants