Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions backend/app/services/auth_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import logging
from datetime import datetime, timezone, timedelta
from typing import Optional, Dict
from urllib.parse import urlencode

import httpx
from jose import jwt, JWTError
Expand All @@ -31,7 +32,7 @@
GITHUB_CLIENT_ID = os.getenv("GITHUB_CLIENT_ID", "")
GITHUB_CLIENT_SECRET = os.getenv("GITHUB_CLIENT_SECRET", "")
GITHUB_REDIRECT_URI = os.getenv(
"GITHUB_REDIRECT_URI", "http://localhost:3000/auth/callback"
"GITHUB_REDIRECT_URI", "http://localhost:3000/auth/github/callback"
)

JWT_SECRET_KEY = os.getenv("JWT_SECRET_KEY") or secrets.token_urlsafe(32)
Expand Down Expand Up @@ -164,11 +165,9 @@ def get_github_authorize_url(state: Optional[str] = None) -> tuple:
"response_type": "code",
}
return (
f"https://github.com/login/oauth/authorize?{'&'.join(f'{k}={v}' for k, v in params.items())}",
f"https://github.com/login/oauth/authorize?{urlencode(params)}",
state,
)


def verify_oauth_state(state: str) -> bool:
"""Verify the OAuth state parameter is valid."""
if not state:
Expand Down
Loading