From 3e7fb7ecc2b9f660ebe64bd5aefd5d11b479c81f Mon Sep 17 00:00:00 2001 From: Ahmad Farhat Date: Wed, 18 Mar 2020 16:26:45 -0400 Subject: [PATCH] GRN2-xx: Added option to specify different redirect url for google auth (#1016) * Added option to specify different redirect url for google auth * Made the redirect url generic so it works with 365 Co-authored-by: Jesus Federico --- config/initializers/omniauth.rb | 2 ++ sample.env | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index 2f4b4f6b..0edb9b67 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -46,12 +46,14 @@ Rails.application.config.middleware.use OmniAuth::Builder do scope: %w(profile email), access_type: 'online', name: 'google', + redirect_uri: ENV['OAUTH2_REDIRECT'].presence || nil, setup: SETUP_PROC end if Rails.configuration.omniauth_office365 Rails.application.config.providers << :office365 provider :office365, ENV['OFFICE365_KEY'], ENV['OFFICE365_SECRET'], + redirect_uri: ENV['OAUTH2_REDIRECT'].presence || nil, setup: SETUP_PROC end end diff --git a/sample.env b/sample.env index ca870e80..6e6496fc 100644 --- a/sample.env +++ b/sample.env @@ -44,6 +44,10 @@ OFFICE365_KEY= OFFICE365_SECRET= OFFICE365_HD= +# OAUTH2_REDIRECT allows you to specify the redirect_url passed to oauth on sign in. +# It is useful for cases when Greenlight is deployed behind a Network Load Balancer or proxy +OAUTH2_REDIRECT= + # LDAP Login Provider (optional) # # You can enable LDAP authentication by providing values for the variables below.