I created a new Rails 5 s app rails new appname --apithat seems great! I want to use it as a backend for an interface with React and eventually in a Chrome app. At the moment I want to create an API.
I used the following gems
- gem 'omniauth'
- gem 'omniauth-oauth2'
- gem 'devise'
- gem 'devise_token_auth', git: 'git: //github.com/lynndylanhurley/devise_token_auth.git'
- gem 'omniauth-twitter'
- gem 'omniauth-facebook'
- gem 'omniauth-google-oauth2'
And I followed the directions on their Github here too to complete the setup: http://www.developingandrails.com/2015/02/api-authentication-with-devisetokenauth.html
And now, when I run the application, I get:
Started GET "/" for 14.144.15.10 at 2016-07-17 17:21:46 +0000
ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
OmniAuth::NoSessionError (You must provide a session to use OmniAuth.):
I was looking for answers on Github and StackOverflow, but no one seems to have a solution.
The only thing that seems to “fix” the problem is this:
config.middleware.use Rack::Session::Cookie
But this “solution” gives me this error in the console:
SECURITY WARNING: No secret option provided to Rack::Session::Cookie.
This poses a security threat. It is strongly recommended that you
provide a secret to prevent exploits that may be possible from crafted
cookies. This will not be supported in future versions of Rack, and
future versions will even invalidate your existing user cookies.
Please, help! Thank.
source
share