omniauth OAuthException & OAuth::Unauthorized

后端 未结 3 1921
囚心锁ツ
囚心锁ツ 2021-01-02 15:46

I have installed omniauth 1.0. Also I have oauth-0.4.5, oauth2-0.5.1, omniauth-facebook-1.0.0, omniauth-twitter-0.0.6.

omniauth.rb
Rails.application.config.m         


        
3条回答
  •  我在风中等你
    2021-01-02 16:10

    Alex D. is correct in that the ENV[] breaks it. To create omniauth.rb so that it uses different keys in different environments just put:

    provider :twitter, TWITTER_KEY, TWITTER_SECRET
    

    in omniauth.rb

    and then in your environment config files (config/environments/development.rb, etc.) put the key you want to use for that environment.

    config/environments/development.rb:

    TWITTER_KEY = 'aaaaaaa'
    TWITTER_SECRET = 'aaaabbbbbb'
    

    config/environments/production.rb:

    TWITTER_KEY = 'ccccccc'
    TWITTER_SECRET = 'ccccffffdffffd'
    

提交回复
热议问题