Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

url correction #86

Merged
merged 3 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
from app.routers.frontend import router as frontend_router
from app.routers.tasks import router as tasks_router
from app.utils.exception_utils import validation_exception_handler
from starlette.middleware.sessions import SessionMiddleware


load_dotenv()
logging.basicConfig(level=logging.INFO)
Expand Down Expand Up @@ -86,6 +88,8 @@ async def lifespan(app: FastAPI):
lifespan=lifespan,
)

# Add SessionMiddleware to enable session-based authentication
app.add_middleware(SessionMiddleware, secret_key=os.getenv("SECRET_KEY"))

static_files_directory = Path(__file__).parent.absolute() / "static"
app.mount("/static", StaticFiles(directory=static_files_directory), name="static")
Expand Down
7 changes: 2 additions & 5 deletions app/routers/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,12 @@ async def change_password(

return {"message": "Password change successful", "success": True}

@router.get("/auth/google/login", name="auth/google_login")
@router.get("/google/login", name="auth/google_login")
async def google_login(request: Request):
redirect_uri = request.url_for("google_callback")
return await oauth.google.authorize_redirect(request, redirect_uri)


@router.get("/auth/google/callback")
@router.get("/google/callback", name="google_callback")
async def google_callback(request: Request, db: AsyncSession = Depends(get_db)):
token = await oauth.google.authorize_access_token(request)
user_info = await oauth.google.parse_id_token(request, token)
Expand Down Expand Up @@ -212,5 +211,3 @@ async def save_organization(

# Redirect to account or another relevant page
return RedirectResponse(url="/account", status_code=status.HTTP_303_SEE_OTHER)


Loading