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

/auth/:provider route not registered? #47

Closed
retorquere opened this issue Feb 7, 2017 · 4 comments
Closed

/auth/:provider route not registered? #47

retorquere opened this issue Feb 7, 2017 · 4 comments
Milestone

Comments

@retorquere
Copy link

I'm hitting an issue where omniauth works in dev mode but not in production using passenger. Under passenger, I am redirected correctly by my app to /auth/auth0 (as I use the auth0 provider) but then get an error from nginx that that url doesn't exist. This is my omniauth config:

configure do
  set :sessions, true
  set :session_secret, (ENV['SESSION_SECRET'].to_s == '' ? SecureRandom.base64 : ENV['SESSION_SECRET'])

  OmniAuth.configure do |config|
    # Always use /auth/failure in any environment
    config.failure_raise_out_environments = []
  end

  use OmniAuth::Builder do
    provider :auth0, ENV['AUTH0_CLIENT_ID'], ENV['AUTH0_CLIENT_SECRET'], ENV['AUTH0_DOMAIN']
  end
end

I've ran this to show my routes:

require_relative 'main' # my sinatra app

Sinatra::Application.routes["GET"].each do |route|
  puts route[0]
end

but that shows only these auth-related routes, even in my development environment:

(?-mix:\A\/auth\/([^\/?#]+)\/callback\z)
(?-mix:\A\/auth\/failure\z)
(?-mix:\A\/auth\/logout\z)

but these are all mine, I was expecting /auth/auth0 (or a regex matching it) to be listed too.

@ClaudioFloreani
Copy link

ClaudioFloreani commented Mar 27, 2017

It's working for me.
I have these in my config/routes.rb:

  # Auth0
  namespace 'auth' do
    scope ':provider' do
      get 'callback'
      get 'failure'
    end
  end

and when I GET "/auth/auth0" it is rendered as expected (redirecting to the provider):

I, [2017-03-27T17:44:04.437440 #26062]  INFO -- omniauth: (auth0) Request phase initiated.
 => 302 

It may be the destination url of the redirection that isn't configured correctly.

@retorquere
Copy link
Author

I've converted the app to node in the interim, so I can't replicate the issue anymore, sorry.

@ClaudioFloreani
Copy link

I think we can close this issue because nothing in this gem is interfering with Omniauth properly handling 'auth/:provider'

@joshcanhelp
Copy link
Contributor

Tested and confirmed, this route is working fine (though it's configured in a few places, which is what might have caused this issue).

Looks like the first route matches?

screenshot 2018-06-22 11 43 04

@joshcanhelp joshcanhelp added this to the v2-Next milestone Oct 30, 2018
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

No branches or pull requests

3 participants