gate-sso / gate

Gate is MFA Enabled SSO Platform that supports SAML, OAuth, Linux shell login and CAS
https://gate-sso.github.io
MIT License
203 stars 52 forks source link

oAuth Failing - NoMethodError - undefined method `new_session_path' for #<Users::OmniauthCallbacksController:0x00007f2c1edfa4e8> Did you mean? new_user_path #195

Closed DrIanGregory closed 3 years ago

DrIanGregory commented 3 years ago

Installed in location: opt/gate. Followed gate-sso installation tutorial from 41:27: https://www.youtube.com/watch?v=yaXiAqH-4LE. Referenced oAuth setup: https://github.com/gate-sso/gate/blob/master/docs/oauth_setup.md

Clicked on Google email to sign in for oAuth. Received crash error.

Failing function: (In file: app/controllers/devise/omniauth_callbacks_controller.rb:30:in `after_omniauth_failure_path_for')

def after_omniauth_failure_path_for(scope) new_session_path(scope) end

Parameters:

{"state"=>"3ddcc88bb9f9520ae73306e2f717796f29ed79170804757e", "code"=>"4/0AX4XfWiOpdqci88FT5xBnylDdOfho4zXATUQ62m2Ct9SW59yML2AqHRXEpEwZIaHeIg0cw", "scope"=>"email profile https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile openid", "authuser"=>"1", "hd"=>"orthogonal.trading", "prompt"=>"consent"}

Response Headers:

None

DrIanGregory commented 3 years ago

Issue resolved by editing .env many times: https://github.com/gate-sso/gate/blob/master/.env.example

And reading this many many times: https://github.com/gate-sso/gate/blob/master/docs/oauth_setup.md

And running the following many many times:

sudo lsof -i -P -n | grep LISTEN sudo kill -9 rake app:setup rvmsudo rails server --port 82 --binding 0.0.0.0 --daemon

DrIanGregory commented 3 years ago

This error is caused by not setting the port number after the URL in the .env file~!~!~~~~!!!!!!

ie. GATE_SERVER_URL=http://example.com:4000

See documentation: https://github.com/gate-sso/gate/blob/master/docs/oauth_setup.md

NOTE:!!! Even if use port 80!!! You must specify it. ie.

GATE_SERVER_URL=http://example.com:80

It is also caused if you place a / after the URL like this:

GATE_SERVER_URL=http://example.com:80/

Do NOT put a '/' at the end of the URL!