0

I'm using a Rails app with Devise (for authentication) and the omniauth gem on a remote server. When I used to deploy to Heroku, I could set environment variables in the terminal, but that's not offered on the remote server I'm using. I therefore added the following to the bottom of .bashrc

export TWITTER_KEY="LxAuQ1Chmas;dlfkjdsal;fjds" TWITTER_SECRET="CC2XpLOeMJbvYphlafsdlkfjdsalkfj"

hoping that would set the environment variables configured in the Devise.rb file

 config.omniauth :twitter, ENV["TWITTER_KEY"], ENV["TWITTER_SECRET"]

However, when I try to sign in with Twitter, I'm getting this

OAuth::Unauthorized (401 Unauthorized):
  oauth (0.4.7) lib/oauth/consumer.rb:216:in `token_request'
  oauth (0.4.7) lib/oauth/consumer.rb:136:in `get_request_token'
  omniauth-oauth (1.0.1) lib/omniauth/strategies/oauth.rb:29:in `request_phase'
  omniauth-twitter (1.0.0) lib/omniauth/strategies/twitter.rb:63:in `request_phase'
  omniauth (1.1.4) lib/omniauth/strategy.rb:214:in `request_call'

so I'm assuming the environment variables aren't be read correctly. Can you explain another way I might set them?

4

1 に答える 1