From 8fccc2c0e99d2fe0be5424d21f3a51e4023c2708 Mon Sep 17 00:00:00 2001 From: Marcel Santos Date: Thu, 4 Apr 2024 19:29:20 -0600 Subject: [PATCH] Revert changes for api domain --- app/controllers/authenticating_controller.rb | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/app/controllers/authenticating_controller.rb b/app/controllers/authenticating_controller.rb index ca43fbf..1b16310 100644 --- a/app/controllers/authenticating_controller.rb +++ b/app/controllers/authenticating_controller.rb @@ -14,8 +14,8 @@ def heroku_app unless match raise 'Could not determine heroku app from host' end - # match[1] is the app name, [2] would be the high level domain (herokuapp or staging.herokuappdev) - match[1], match[2] + + match[1] end end @@ -40,25 +40,18 @@ def get_app_info(heroku_api, app_name) end end - def platform_api_client(token, domain) - if domain.end_with?("herokuappdev") - return PlatformAPI.connect_oauth(token, url: "https://api.staging.herokudev.com") - end - PlatformAPI.connect_oauth(token) - end - def authenticate_user! auth_header = request.authorization - app_name, domain = heroku_app + app_name = heroku_app # try first to authenticate the request from Bearer token authorization header and # if that doesn't work try the previous session_id from the cookies if auth_header token = auth_header.match(/Bearer (.*)$/)[1] - heroku_api = platform_api_client(token, domain) + heroku_api = PlatformAPI.connect_oauth(token) get_app_info(heroku_api, app_name) elsif session && session['token'] && session['email'] session = cookies.encrypted[:_session_id] - heroku_api = platform_api_client(session['token'], domain) + heroku_api = PlatformAPI.connect_oauth(session['token']) get_app_info(heroku_api, app_name) session['email'] end