ruby - "CSRF detected" with Omniauth and Google -
i'm getting this
omniauth::strategies::oauth2::callbackerror @ /auth/google/callback csrf_detected | csrf detected
my code:
require 'sinatra' require "sinatra/json" require "sinatra/config_file" require 'omniauth-oauth2' require 'omniauth-google-oauth2' use rack::logger config_file "config/app_config.yml" use rack::session::cookie, secret: '5fb7w345y3489f523y4h' configure enable :sessions end use omniauth::builder provider :google_oauth2, settings.google[:client_id], settings.google[:secret], { :scope => "userinfo.profile", :access_type => "offline", :prompt => "select_account consent", :name => "google" } end '/list' json get_list end '/' %q|<a href='/auth/google'>sign in google</a>| end '/auth/:name/callback' @auth = request.env['omniauth.auth'] @auth.inspect end my callback returning both code , state.
got same problem
(google_oauth2) callback phase initiated.
(google_oauth2) authentication failure! csrf_detected: omniauth::strategies::oauth2::callbackerror, csrf_detected | csrf detected
last omniauth-oauth2 update introduced "state" param has mandatory field.
some people suggest using provider_ignores_state: true it's bad idea because introduces csrf flaw
guess we'll have downgrade previous version keep google_oauth2 working.
issue on https://github.com/intridea/omniauth-oauth2/issues/58
Comments
Post a Comment