first commit

This commit is contained in:
Beyhan Oğur
2026-04-26 22:25:19 +03:00
commit 361dbef019
25 changed files with 814 additions and 0 deletions

27
app/core/oauth.py Normal file
View File

@@ -0,0 +1,27 @@
from urllib.parse import urlencode
from typing import Dict
from app.core.config import settings
def google_authorize_url(state: str = "state") -> str:
params = {
"client_id": settings.GOOGLE_CLIENT_ID,
"redirect_uri": settings.GOOGLE_REDIRECT_URL,
"response_type": "code",
"scope": "openid email profile",
"state": state,
"access_type": "offline",
"prompt": "consent",
}
return "https://accounts.google.com/o/oauth2/v2/auth?" + urlencode(params)
def github_authorize_url(state: str = "state") -> str:
params = {
"client_id": settings.GITHUB_CLIENT_ID,
"redirect_uri": settings.GITHUB_REDIRECT_URL,
"scope": "user:email",
"state": state,
}
return "https://github.com/login/oauth/authorize?" + urlencode(params)