first commit
This commit is contained in:
27
app/core/oauth.py
Normal file
27
app/core/oauth.py
Normal 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)
|
||||
Reference in New Issue
Block a user