Skip to content

Commit 8b4862d

Browse files
committed
refactor: move constants into module
1 parent 0a5ada6 commit 8b4862d

File tree

9 files changed

+14
-12
lines changed

9 files changed

+14
-12
lines changed

fastapi/app/auth/github/libs.py renamed to fastapi/app/auth/github/backend.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
from ..exceptions import BadCredentialException
55
from ..libs import bearer_transport, get_jwt_strategy
66
from ..models import User
7-
from .constants import GITHUB_USERINFO_URL
7+
8+
GITHUB_USERINFO_URL = 'https://api.github.com/user'
89

910

1011
class GithubAuthBackend(OAuthBackend):

fastapi/app/auth/github/constants.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

fastapi/app/auth/github/routes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from httpx_oauth.clients.github import GitHubOAuth2
44

55
from ..libs import fastapi_users
6-
from .libs import auth_backend
6+
from .backend import auth_backend
77

88
github_oauth_client = GitHubOAuth2(
99
client_id=Configs.GITHUB_CLIENT_ID,

fastapi/app/auth/google/libs.py renamed to fastapi/app/auth/google/backend.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
from ..exceptions import BadCredentialException
55
from ..libs import bearer_transport, get_jwt_strategy
66
from ..models import User
7-
from .constants import GOOGLE_USERINFO_URL
7+
8+
GOOGLE_USERINFO_URL = "https://www.googleapis.com/oauth2/v3/userinfo"
9+
GOOGLE_SCOPE_PROFILE = "https://www.googleapis.com/auth/userinfo.profile"
10+
GOOGLE_SCOPE_EMAIL = "https://www.googleapis.com/auth/userinfo.email"
811

912

1013
class GoogleAuthBackend(OAuthBackend):

fastapi/app/auth/google/constants.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

fastapi/app/auth/google/routes.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
from httpx_oauth.clients.google import GoogleOAuth2
44

55
from ..libs import fastapi_users
6-
from .constants import GOOGLE_SCOPE_EMAIL, GOOGLE_SCOPE_PROFILE
7-
from .libs import auth_backend
6+
from .backend import auth_backend
7+
8+
GOOGLE_SCOPE_PROFILE = "https://www.googleapis.com/auth/userinfo.profile"
9+
GOOGLE_SCOPE_EMAIL = "https://www.googleapis.com/auth/userinfo.email"
810

911
google_oauth_client = GoogleOAuth2(
1012
client_id=Configs.GOOGLE_CLIENT_ID,

fastapi/app/auth/kakao/libs.py renamed to fastapi/app/auth/kakao/backend.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
from ..exceptions import BadCredentialException
77
from ..libs import bearer_transport, get_jwt_strategy
88
from ..models import User
9-
from .constants import KAKAO_USERINFO_URL
9+
10+
KAKAO_USERINFO_URL = 'https://kapi.kakao.com/v2/user/me'
1011

1112

1213
class KakaoAuthBackend(OAuthBackend):

fastapi/app/auth/kakao/constants.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

fastapi/app/auth/kakao/routes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from ..libs import fastapi_users
44
from .client import KakaoOAuth2
5-
from .libs import auth_backend
5+
from .backend import auth_backend
66

77
kakao_oauth_client = KakaoOAuth2(
88
client_id=Configs.KAKAO_CLIENT_ID,

0 commit comments

Comments
 (0)