🚑 Fixed OAuth bug
This commit is contained in:
@@ -12,6 +12,7 @@ settings = settings()
|
||||
@lru_cache()
|
||||
def init_oauth() -> OAuth:
|
||||
oauth = OAuth()
|
||||
if settings.google_client_secret is not None and settings.google_client_id is not None:
|
||||
oauth.register(
|
||||
name="google",
|
||||
server_metadata_url="https://accounts.google.com/.well-known/openid-configuration",
|
||||
@@ -19,7 +20,7 @@ def init_oauth() -> OAuth:
|
||||
client_id=settings.google_client_id,
|
||||
client_secret=settings.google_client_secret,
|
||||
)
|
||||
|
||||
if settings.github_client_id is not None and settings.github_client_secret is not None:
|
||||
oauth.register(
|
||||
name="github",
|
||||
client_kwargs={"scope": "read:user user:email"},
|
||||
@@ -31,6 +32,10 @@ def init_oauth() -> OAuth:
|
||||
client_id=settings.github_client_id,
|
||||
client_secret=settings.github_client_secret,
|
||||
)
|
||||
if (
|
||||
settings.custom_openid_provider.client_id is not None
|
||||
and settings.custom_openid_provider.client_secret is not None
|
||||
):
|
||||
oauth.register(
|
||||
name="custom",
|
||||
client_kwargs={"scope": settings.custom_openid_provider.scopes},
|
||||
|
||||
Reference in New Issue
Block a user