omnigollum icon indicating copy to clipboard operation
omnigollum copied to clipboard

omnigollum not handing off to omniauth?

Open beporter opened this issue 4 years ago • 6 comments

I followed the setup for using zquestz/omniauth-google-oauth2 and put that into the omnigollum_options:

omnigollum_options = {
  providers: Proc.new do
    provider :google_oauth2, ENV['GOOGLE_CLIENT_ID'], ENV['GOOGLE_CLIENT_SECRET']
  end,
  dummy_auth: false,
}

but when trying to access a protected route, I get bounced to /__omnigollum__/auth/google_oauth2?origin=%2F, which 404's with no errors in the console.

I'm not sure if this is a version thing with sinatra or some other component, but digging into the code, this part seems... wrong? https://github.com/arr2036/omnigollum/blob/4c098d2/lib/omnigollum.rb#L310

      # Stop sinatra processing and hand off to omniauth
      app.before options[:route_prefix] + '/auth/:provider' do
        halt 404
      end

If the intent is to pass control back to OmniAuth, shouldn't this be pass or forward or call instead of halt?

beporter avatar Feb 20 '21 23:02 beporter

Having exactly the same issue here using the github provider. It goes to /__omnigollum__/auth/github?origin=%2F with the behavior as beporter explains..

mcbloch avatar Feb 24 '21 00:02 mcbloch

I also experience the same issue with github provider, it redirects to /__omnigollum__/auth/github?origin=%2F

marius-hi avatar Mar 15 '21 23:03 marius-hi

I found this is due to the recent security fixes in OmniAuth that disabled GET access to "/auth/:provider". We can workaround this by adding the following lines to the config file:

OmniAuth.config.allowed_request_methods = [:post, :get]

Though, this is not an optimal solution in terms of security.

After applying the above change, I could configure wiki to be invisible to unauthorized users, still I couldn't make it editable for authorized users (got "error updating page" message). I don't know if this is due to that my fix is incomplete.

yotarok avatar Jun 15 '21 14:06 yotarok

Same problem here with the Github provider.

fhchl avatar Oct 04 '21 14:10 fhchl

I got OAuth working with Gollum here: https://github.com/woodie/gollum-wiki-oauth/

I'm going about this by configuring Nginx to do OAuth, and then swiping the email address from the headers.

woodie avatar Oct 25 '21 20:10 woodie