diff --git a/app/main.py b/app/main.py index dbbd53d..ab73c99 100644 --- a/app/main.py +++ b/app/main.py @@ -94,12 +94,12 @@ async def register(user: UserRegisterDTO): ) hashed_password = get_password_hash(user.password) - users_collection.insert_one({"username": user.username, "password": hashed_password}) + user_id = users_collection.insert_one({"username": user.username, "password": hashed_password}) access_token_expires = timedelta(minutes=ACCESS_TOKEN_EXPIRE_MINUTES) access_token = create_access_token(data={"sub": user.username}, expires_delta=access_token_expires) - return {"access_token": access_token, "token_type": "bearer", "user_id": str(user["_id"])} + return {"access_token": access_token, "token_type": "bearer", "user_id": str(user_id)} @app.post( path="/login",