Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

am not able to setup the OmniAuth strategy #37

Closed
deepak opened this issue May 3, 2016 · 0 comments · Fixed by #38
Closed

am not able to setup the OmniAuth strategy #37

deepak opened this issue May 3, 2016 · 0 comments · Fixed by #38

Comments

@deepak
Copy link
Contributor

deepak commented May 3, 2016

I am trying to setup like so:

AUTH0_SETUP = lambda do |env|
  req = Rack::Request.new(env)

  namespace = 'foobar.auth0.com'
  site = "https://#{namespace}"
  client_info_querystring = "..."

  env['omniauth.strategy'].options[:client_id] = 'some-id'
  env['omniauth.strategy'].options[:client_secret] = 'some-secret'
  env['omniauth.strategy'].options[:namespace] = namespace
  env['omniauth.strategy'].options[:provider_ignores_state] = { callback_path: "/auth/auth0/callback" }
  env['omniauth.strategy'].options[:client_options]
    .merge!(site: site,
      authorize_url: "#{site}/authorize?#{client_info_querystring}",
      token_url: "#{site}/oauth/token?#{client_info_querystring}",
      userinfo_url: "#{site}/userinfo")
end

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :auth0, setup: AUTH0_SETUP
end

but this does not work because OmniAuth::Strategies::Auth0::initialize depends on args
and has a check on argument

fail(ArgumentError.new("Received wrong number of arguments. #{args.inspect}")) if @options[: namespace].nil?

but in case of setup args will be [{setup: <Proc>}] and will not have the namespace it needs

other Omniauth strategies like facebook use the option class method to configure it
and do not use the initialize method

@deepak deepak mentioned this issue May 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant