28 lines
827 B
Python
28 lines
827 B
Python
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)
|