The ability to transfer user data at the request of users who support Omniauth

Omniauth branch 0-3-stable from git: //github.com/intridea/omniauth.git Rails 3.0.7

When Omniauth redirects a user to the Facebook auth dialog by making a GET call to "/ auth / facebook", if that user clicks Cancel from the auth dialog, we can request a callback

GET "/auth/facebook/callback?error_reason=user_denied&error=access_denied&error_description=The+user+denied+your+request." 

      

which Omniauth immediately redirects to:

GET "/auth/failure?message=invalid_credentials"

      

Sorry when this is the answer to the application. the prompt generated by the FB dialog is missing the identity of which user "Canceled" from the auth dialog. If we could send some identifying information with the Omniauth request, we could afford to "remember" which "Cancel" was performed by the user, which would help us track down obvious back-end rejections.

Is there a way to send data with a call to "/ auth / facebook" that will just be returned to us by calling "/ auth / facebook / callback"? This will be similar to the "data" parameter in the query documentation documentation.

Thanks, Wes

+3


source to share


1 answer


You can go through a state parameter that will be passed in the callback url.

eg. are you calling '/ auth / facebook? state = SOME_INFO '

Then, in the action of the controller you point to '/ auth / facebook / callback', you get the same as a normal parameter:



info = params [: state]

The parameter should be named "state". This is mentioned in the omniauth-facebook documentation under Request Parameters. https://github.com/mkdynamic/omniauth-facebook

+4


source







All Articles