Skip to content


When calling /auth/:identity/callback.json , request.env["omniauth.auth"] is nil #618

andrei4002 opened this Issue · 8 comments

8 participants


Let's say that I have to connect with facebook.

My app works perfectly if i call




but when i try to call


there is no request.env[ "omniauth.auth" ]

(it's nil)

Any ideas of what's going on? (I'll provide more additional info if asked. not sure what else is needed)


:+1: Though I'm having the issue with a a custom provider - working on ownership of both the provider and the client


Thanks @andrei4002 , you solved an issue of mine... can't figure out why callback.js wouldn't work... anyway callback?format=js does the trick for us ;)


Same problem here on a rails-api app which renders just json. In my case a Google Api redirect_uri can't be with parameters, when I try to add ?format=json in console and midddleware initializer I get

(google) Authentication failure! invalid_credentials: OAuth2::Error, redirect_uri_mismatch:                                                                                              
  "error" : "redirect_uri_mismatch"                                                                                                                                               

Seems that I will have to respond to html and set session manually.


+1 to this issue. Does anyone know the root cause why .json doesn't work?


Still open after 3 years? Have the same issue, and it really should get fixed..


Still causing headaches in 2016


I browsed a little and it seems that in,

callback_path is hardcoded to be /auth/facebook/callback, and when current_path is compared to expected strategy's path (current_path.casecmp(path) == 0) the test fails and omniauth doesn't kick in.

Quick fix: use ?format=json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.