Using omniauth for facebook, I would like to pass some extra parameters to the URL in order to handle them on the callback.
I found a lot of documentation about this (in addition to the official documentation, this one, for example: Devise + Omniauth - How to pass extra parameters along?). But no one worked for me.
Using:
omniauth_authorize_path(:user, :facebook, msg: 'Hello')
produces this url:
/users/auth/facebook?locale=fr
Any idea of why it doesn't work? Thanks.
Update:
The parameter locale=fr
is because I have asked the application to always use a locale
in the URL. My application_controller.rb uses the following method:
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :set_locale
def set_locale
I18n.locale = params[:locale] || I18n.default_locale
end
# Always add :locale parameter to URL
def url_options
{:locale => I18n.locale}.merge(super)
end
end
Removing url_options method doesn't solve the problem, and now gives the following URL:
/users/auth/facebook