Properly handle the right URL for the github authentication

This commit is contained in:
R. Tyler Croy 2017-08-27 11:11:59 -07:00
parent e611936d43
commit 12915c0879
No known key found for this signature in database
GPG Key ID: 1426C7DC3F51E16F
4 changed files with 12 additions and 4 deletions

View File

@ -30,7 +30,7 @@ items:
- name: PRODUCTION
value: 'true'
- name: REDIRECT_URI
value: 'http://codevalet.io/github/authenticate'
value: 'https://codevalet.io/github/authenticate'
- name: GITHUB_CLIENT_ID
value: '790a28783a813e2b2b3c'
- name: GITHUB_CLIENT_SECRET

View File

@ -24,7 +24,13 @@ server {
include /etc/nginx/monkeys.conf;
location / {
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://$webapp:$webapp_port;
}
}

View File

@ -30,6 +30,7 @@ __END__
<% locations.each_pair do |name, data| %>
location /u/<%= name %> {
proxy_set_header Host $host;
proxy_pass http://<%= data[:host] %>:<%= data[:port] %>;
}

View File

@ -14,6 +14,8 @@ module CodeValet
<<-EOS
<h2>Unable to authenticate, sorry bud.</h2>
<p>#{env['warden'].message}</p>
<p>#{ENV['REDIRECT_URI']}</p>
<p>#{ENV['GITHUB_CLIENT_ID']}</p>
EOS
end
end
@ -97,7 +99,7 @@ module CodeValet
login = session[:admin_instance]
session[:admin_instance] = nil
end
href = "http://#{login}.codevalet.io/#{redirect_path}"
href = "https://codevalet.io/u/#{login}/#{redirect_path}"
end
redirect to(href)
end
@ -117,13 +119,12 @@ module CodeValet
login = params['instance']
session[:admin_instance] = login
end
href = "http://#{login}.codevalet.io/#{redirect_path}"
href = "https://codevalet.io/u/#{login}/#{redirect_path}"
end
redirect to(href)
end
get '/github/logout' do
session[:oauthcode] = nil
env['warden'].logout
redirect '/'
end