You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
When calling /auth/:identity/callback.json , request.env["omniauth.auth"] is nil #618
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
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.
The use-cases are to integrate Facebook Login with a client-side workflow. Instead of 302 redirecting the client to facebook then back to /auth/facebook/callback you do :
Browser async calls Facebook who returns authentication hash
Browser async calls /auth/facebook/callback.json to validate the authentication hash
Browser can then decide wether to proceed or not and the page was not changed during the process
I'm still looking for a workaround. In my case I want to have multiple providers point to the same callback-url, which is not possible with the workaround given here.
You still initalize the oauth by POST /auth/my_custom_name, but the callback happens the given redirect_uri and with the callback_path set, request.env['omniauth.auth'] is set correctly.
Activity
jphenow commentedon Jul 6, 2012
👍 Though I'm having the issue with a a custom provider - working on ownership of both the provider and the client
xlozinguez commentedon Aug 12, 2012
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 ;)
BartlomiejSkwira commentedon Aug 30, 2013
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=jsonin console and midddleware initializer I getSeems that I will have to respond to html and set session manually.
adammcnamara commentedon Nov 14, 2014
+1 to this issue. Does anyone know the root cause why .json doesn't work?
philipgiuliani commentedon Aug 3, 2015
Still open after 3 years? Have the same issue, and it really should get fixed..
Dragsbaek commentedon Dec 31, 2015
+1
tzafrir commentedon Jan 11, 2016
Still causing headaches in 2016
tzafrir commentedon Jan 11, 2016
I browsed a little and it seems that in https://github.com/intridea/omniauth/blob/master/lib/omniauth/strategy.rb,
callback_pathis hardcoded to be/auth/facebook/callback, and whencurrent_pathis 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
tmilewski commentedon Feb 12, 2017
@tzafrir is correct. What are the use-cases of redirecting a callback/user to a
.jsonfile?babgyy commentedon Jul 31, 2018
The use-cases are to integrate Facebook Login with a client-side workflow. Instead of 302 redirecting the client to facebook then back to /auth/facebook/callback you do :
babgyy commentedon Jul 31, 2018
Thanks @andrei4002, after all this time, your solution does the job, and should definitely be in the docs
lasseebert commentedon Jun 22, 2022
I'm still looking for a workaround. In my case I want to have multiple providers point to the same callback-url, which is not possible with the workaround given here.
lasseebert commentedon Jun 22, 2022
I found a solution: Use both
redirect_uriandcallback_path, which should match:You still initalize the oauth by
POST /auth/my_custom_name, but the callback happens the givenredirect_uriand with thecallback_pathset,request.env['omniauth.auth']is set correctly.Recognize callback paths with a format suffix