mirror of
https://github.com/maxdorninger/MediaManager.git
synced 2026-04-17 23:53:58 +02:00
fix: fix broken password+email login because of CORS
This commit is contained in:
@@ -101,7 +101,8 @@ class RedirectingCookieTransport(CookieTransport):
|
||||
|
||||
|
||||
bearer_transport = BearerTransport(tokenUrl="auth/jwt/login")
|
||||
cookie_transport = RedirectingCookieTransport(cookie_max_age=LIFETIME)
|
||||
cookie_transport = CookieTransport(cookie_max_age=LIFETIME)
|
||||
oauth_cookie_transport = RedirectingCookieTransport(cookie_max_age=LIFETIME)
|
||||
|
||||
bearer_auth_backend = AuthenticationBackend(
|
||||
name="jwt",
|
||||
@@ -113,6 +114,11 @@ cookie_auth_backend = AuthenticationBackend(
|
||||
transport=cookie_transport,
|
||||
get_strategy=get_jwt_strategy,
|
||||
)
|
||||
oauth_cookie_auth_backend = AuthenticationBackend(
|
||||
name="cookie",
|
||||
transport=oauth_cookie_transport,
|
||||
get_strategy=get_jwt_strategy,
|
||||
)
|
||||
|
||||
fastapi_users = FastAPIUsers[User, uuid.UUID](get_user_manager, [bearer_auth_backend, cookie_auth_backend])
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
from auth.schemas import UserCreate, UserRead, UserUpdate
|
||||
from auth.users import bearer_auth_backend, fastapi_users, cookie_auth_backend
|
||||
from auth.users import bearer_auth_backend, fastapi_users, cookie_auth_backend, oauth_cookie_auth_backend
|
||||
from auth.router import users_router as custom_users_router
|
||||
from auth.router import auth_metadata_router
|
||||
basic_config = BasicConfig()
|
||||
@@ -136,7 +136,7 @@ app.include_router(
|
||||
if oauth_client is not None:
|
||||
app.include_router(
|
||||
fastapi_users.get_oauth_router(oauth_client,
|
||||
cookie_auth_backend,
|
||||
oauth_cookie_auth_backend,
|
||||
auth.users.SECRET,
|
||||
associate_by_email=True,
|
||||
is_verified_by_default=True,
|
||||
|
||||
Reference in New Issue
Block a user