I managed to do this by checking the request object on my firewall.
When I make a request in my application, I add data about the view defining the format:
format: "json"
Omniauth then makes a callback to
/auth/:provider/callback
In my case, it matches
sessions
as an HTML request. But as soon as there, if you look at your request object in rails and search for the omniauth.params hash, you will see that one of the values โโis the format transmitted according to the initial request:
"omniauth.params"=>{"format"=>"json", "provider"=>"facebook", "code"=>"..."}
You are looking for this "format" => "json" as your mother and rendering json as an answer.
I hope it solves your problem.
source share