joshm
(Josh)
26 Marzo 2019, 12:43pm
1
Hi!
My users cannot log in with Facebook anymore. This is the error log:
(facebook) Authentication failure! csrf_detected: OmniAuth::Strategies::OAuth2::CallbackError, csrf_detected | CSRF detected
I’m using Cloudflare in front of nginx. I’m using Cloudflare automatic SSL (flexible). I didn’t install any certificate on my server (i.e. I’m not using Letsencrypt).
Is this related to Cloudflare? Can this be solved without installing Letsencrypt?
Thanks!
This error is similar both for Google and Facebook. In my configuration there was a line in nginx:
# proxy_set_header X-Forwarded-Proto $https;
After I changed it to
proxy_set_header X-Forwarded-Proto $scheme;
the error has gone.
Solution was found after reading this topic: Redirect URI mismatch in Google Auth
2 Mi Piace
Devo migliorare la mia risposta.
Dopo aver giocato con l’autenticazione FB e Google, sono rimasto su Office365 login a causa della policy aziendale.
Quando ho spostato il mio server discourse dietro un proxy (vedi l’immagine sotto), l’autenticazione O365 è diventata non disponibile. Richiede force https abilitato e questa opzione è rotta dietro il proxy. Fortunatamente risolto da Daniel: Moved site behind proxy, favicon and header not using https anymore - #11 by rossierd .
La riga nella configurazione Nginx interna
proxy_set_header X-Forwarded-Proto $scheme;
dovrebbe essere sostituita con
proxy_set_header X-Forwarded-Proto "https";
Nginx esterno non necessita di tale modifica. Ha:
proxy_set_header X-Forwarded-Proto $scheme;
Probabilmente lo stesso vale per FB, Google e altri tipi di autenticazione.
P.S.
Ovviamente quella stringa conteneva un errore di battitura $ ed era inutile.
1 Mi Piace