Skip to content

Commit

Permalink
If not in debug mode, force google auth to use the https protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
sabaimran committed Dec 17, 2024
1 parent bcc1bc6 commit f291884
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/khoj/processor/conversation/google/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
from khoj.utils import state
from khoj.utils.helpers import (
get_chat_usage_metrics,
in_debug_mode,
is_none_or_empty,
is_promptrace_enabled,
)
Expand Down
1 change: 0 additions & 1 deletion src/khoj/processor/conversation/offline/chat_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
from khoj.utils.constants import empty_escape_sequences
from khoj.utils.helpers import (
ConversationCommand,
in_debug_mode,
is_none_or_empty,
is_promptrace_enabled,
truncate_code_context,
Expand Down
5 changes: 5 additions & 0 deletions src/khoj/routers/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
update_telemetry_state,
)
from khoj.utils import state
from khoj.utils.helpers import in_debug_mode

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -214,6 +215,10 @@ async def auth(request: Request):

# 1. Construct the full redirect URI including domain
base_url = str(request.base_url).rstrip("/")

if not in_debug_mode():
base_url = base_url.replace("http://", "https://")

redirect_uri = f"{base_url}{request.app.url_path_for('auth')}"

payload = {
Expand Down

0 comments on commit f291884

Please sign in to comment.