{"id":38471,"date":"2024-11-01T18:17:20","date_gmt":"2024-11-01T18:17:20","guid":{"rendered":"http:\/\/atmokpo.com\/w\/?p=38471"},"modified":"2024-11-26T06:44:15","modified_gmt":"2024-11-26T06:44:15","slug":"fastapi-%ec%84%9c%eb%b2%84%ea%b0%9c%eb%b0%9c-oauth2%ec%99%80-jwt%eb%a5%bc-%ec%82%ac%ec%9a%a9%ed%95%9c-%ec%95%a0%ed%94%8c%eb%a6%ac%ec%bc%80%ec%9d%b4%ec%85%98-%eb%b3%b4%ec%95%88","status":"publish","type":"post","link":"https:\/\/atmokpo.com\/w\/38471\/","title":{"rendered":"FastAPI \uc11c\ubc84\uac1c\ubc1c, OAuth2\uc640 JWT\ub97c \uc0ac\uc6a9\ud55c \uc560\ud50c\ub9ac\ucf00\uc774\uc158 \ubcf4\uc548"},"content":{"rendered":"<p><body><\/p>\n<p>\ud604\ub300 \uc6f9 \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uc740 \ub2e4\uc591\ud55c \ubcf4\uc548 \uc704\ud611\uc5d0 \ub178\ucd9c\ub418\uc5b4 \uc788\uc73c\uba70, \uc0ac\uc6a9\uc790 \uc778\uc99d \ubc0f \uad8c\ud55c \ubd80\uc5ec\ub294 \uc774\ub7ec\ud55c \uc704\ud611\uc73c\ub85c\ubd80\ud130 \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uc744 \ubcf4\ud638\ud558\ub294 \ub370 \ud544\uc218\uc801\uc785\ub2c8\ub2e4. \ubcf8 \ube14\ub85c\uadf8\uc5d0\uc11c\ub294 FastAPI\ub97c \uc0ac\uc6a9\ud558\uc5ec OAuth2 \ud504\ub85c\ud1a0\ucf5c\uacfc JWT(JSON Web Token)\ub97c \ud1b5\ud55c \uc778\uc99d \ubc0f \uad8c\ud55c \ubd80\uc5ec \uc2dc\uc2a4\ud15c\uc744 \uad6c\ucd95\ud558\ub294 \ubc29\ubc95\uc744 \uc790\uc138\ud788 \uc124\uba85\ud558\uaca0\uc2b5\ub2c8\ub2e4. \uc774 \uae00\uc744 \ud1b5\ud574 \ub3c5\uc790\ub4e4\uc740 FastAPI\ub85c \uc548\uc804\ud55c \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uc744 \uac1c\ubc1c\ud558\ub294 \ub370 \ud544\uc694\ud55c \uc9c0\uc2dd\uc744 \uc2b5\ub4dd\ud560 \uc218 \uc788\uc744 \uac83\uc785\ub2c8\ub2e4.<\/p>\n<h2>1. FastAPI \uc18c\uac1c<\/h2>\n<p>FastAPI\ub294 Python\uc73c\ub85c \uc791\uc131\ub41c \ucd5c\uc2e0 \uc6f9 \ud504\ub808\uc784\uc6cc\ud06c\ub85c, \ub9e4\uc6b0 \ube60\ub974\uace0 \ud604\ub300\uc801\uc778 API\ub97c \uac1c\ubc1c\ud558\uae30 \uc704\ud574 \uc124\uacc4\ub418\uc5c8\uc2b5\ub2c8\ub2e4. FastAPI\ub294 \ub2e4\uc74c\uacfc \uac19\uc740 \uc8fc\uc694 \ud2b9\uc9d5\uc744 \uac00\uc9c0\uace0 \uc788\uc2b5\ub2c8\ub2e4:<\/p>\n<ul>\n<li><strong>\ub192\uc740 \uc131\ub2a5:<\/strong> FastAPI\ub294 Starlette\ub97c \uae30\ubc18\uc73c\ub85c \ud558\uc5ec \ube44\ub3d9\uae30 \ucc98\ub9ac\ub97c \ucd5c\uc801\ud654\ud558\uace0, Uvicorn \ub4f1\uc758 \ube44\ub3d9\uae30 \uc11c\ubc84\uc640 \ud568\uaed8 \uc0ac\uc6a9\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/li>\n<li><strong>\uc790\ub3d9 \ubb38\uc11c\ud654:<\/strong> FastAPI\ub294 OpenAPI \ubc0f JSON Schema\ub97c \uc9c0\uc6d0\ud558\uc5ec \ubb38\uc11c\ud654\ub97c \uc790\ub3d9\uc73c\ub85c \uc0dd\uc131\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/li>\n<li><strong>\uc26c\uc6b4 \uc0ac\uc6a9:<\/strong> \uac04\ub2e8\ud55c \ucf54\ub4dc\ub85c \ubcf5\uc7a1\ud55c API\ub97c \uad6c\ucd95\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/li>\n<\/ul>\n<h3>1.1 FastAPI \uc124\uce58<\/h3>\n<p>FastAPI\ub97c \uc0ac\uc6a9\ud558\ub824\uba74 \uba3c\uc800 FastAPI\uc640 Uvicorn\uc744 \uc124\uce58\ud574\uc57c \ud569\ub2c8\ub2e4. \ub2e4\uc74c \uba85\ub839\uc5b4\ub97c \uc0ac\uc6a9\ud558\uc5ec \uc124\uce58\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4:<\/p>\n<pre><code>pip install fastapi uvicorn<\/code><\/pre>\n<h2>2. OAuth2\uc640 JWT \uac1c\uc694<\/h2>\n<p>OAuth2\ub294 \uc0ac\uc6a9\uc790\uac00 \uc81c3\uc790 \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uc5d0 \ub300\ud55c \uc811\uadfc\uc744 \uc81c\uc5b4\ud560 \uc218 \uc788\ub3c4\ub85d \ud574\uc8fc\ub294 \uad8c\ud55c \ubd80\uc5ec \ud504\ub808\uc784\uc6cc\ud06c\uc785\ub2c8\ub2e4. JWT\ub294 \uc778\uc99d \uc815\ubcf4\ub97c \uc548\uc804\ud558\uac8c \uc804\uc1a1\ud558\uae30 \uc704\ud574 \uc815\ubcf4\uc758 \uc804\uc790 \uc11c\uba85\ub41c JSON \uac1d\uccb4\uc785\ub2c8\ub2e4. \uc774 \ub450 \uae30\uc220\uc744 \uacb0\ud569\ud558\uba74 \uc548\uc804\ud558\uace0 \uc2e0\ub8b0\ud560 \uc218 \uc788\ub294 \uc778\uc99d \uc2dc\uc2a4\ud15c\uc744 \uad6c\ucd95\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n<h3>2.1 OAuth2 \ud750\ub984<\/h3>\n<p>OAuth2\ub294 \ub2e4\uc74c\uacfc \uac19\uc740 \ud750\ub984\uc744 \ub530\ub985\ub2c8\ub2e4:<\/p>\n<ol>\n<li>\uc0ac\uc6a9\uc790\uac00 \ud074\ub77c\uc774\uc5b8\ud2b8 \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uc5d0\uc11c \ub85c\uadf8\uc778 \uc694\uccad\uc744 \ud569\ub2c8\ub2e4.<\/li>\n<li>\ud074\ub77c\uc774\uc5b8\ud2b8 \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uc740 \uc778\uc99d \uc11c\ubc84\uc5d0 \uc0ac\uc6a9\uc790 \uc778\uc99d\uc744 \uc694\uccad\ud569\ub2c8\ub2e4.<\/li>\n<li>\uc778\uc99d \uc11c\ubc84\ub294 \uc0ac\uc6a9\uc790 \uc790\uaca9 \uc99d\uba85\uc744 \uac80\uc99d\ud55c \ud6c4, \ud074\ub77c\uc774\uc5b8\ud2b8\uc5d0 \uc561\uc138\uc2a4 \ud1a0\ud070\uacfc \uac31\uc2e0 \ud1a0\ud070\uc744 \ubc1c\uae09\ud569\ub2c8\ub2e4.<\/li>\n<li>\ud074\ub77c\uc774\uc5b8\ud2b8\ub294 API \uc694\uccad \uc2dc \uc774 \uc561\uc138\uc2a4 \ud1a0\ud070\uc744 \uc0ac\uc6a9\ud558\uc5ec \ubcf4\ud638\ub41c \ub9ac\uc18c\uc2a4\uc5d0 \uc811\uadfc\ud569\ub2c8\ub2e4.<\/li>\n<\/ol>\n<h3>2.2 JWT \uad6c\uc870<\/h3>\n<p>JWT\ub294 \uc138 \ubd80\ubd84\uc73c\ub85c \uad6c\uc131\ub429\ub2c8\ub2e4:<\/p>\n<ul>\n<li><strong>Header:<\/strong> \ud1a0\ud070\uc758 \ud0c0\uc785\uacfc \uc11c\uba85 \uc54c\uace0\ub9ac\uc998 \uc815\ubcf4\ub97c \ud3ec\ud568\ud569\ub2c8\ub2e4.<\/li>\n<li><strong>Payload:<\/strong> \uc0ac\uc6a9\uc790 \uc815\ubcf4\uc640 \uac19\uc740 \ud074\ub808\uc784(Claims)\ub97c \ud3ec\ud568\ud569\ub2c8\ub2e4.<\/li>\n<li><strong>Signature:<\/strong> Header\uc640 Payload\ub97c \uc778\ucf54\ub529\ud558\uc5ec \ube44\ubc00 \ud0a4\ub85c \uc11c\uba85\ud55c \uac12\uc785\ub2c8\ub2e4.<\/li>\n<\/ul>\n<h2>3. FastAPI\uc5d0\uc11c OAuth2\uc640 JWT \uad6c\ud604\ud558\uae30<\/h2>\n<p>\uc774\uc81c FastAPI\ub97c \uc0ac\uc6a9\ud558\uc5ec OAuth2\uc640 JWT\ub97c \ud1b5\ud55c \uc778\uc99d \uc2dc\uc2a4\ud15c\uc744 \uad6c\ud604\ud574 \ubcf4\uaca0\uc2b5\ub2c8\ub2e4. \uc774\ub97c \uc704\ud574 \uae30\ubcf8\uc801\uc778 FastAPI \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uc744 \uc124\uc815\ud558\uace0, OAuth2\uc640 JWT \ub85c\uc9c1\uc744 \ucd94\uac00\ud558\uaca0\uc2b5\ub2c8\ub2e4.<\/p>\n<h3>3.1 FastAPI \uc560\ud50c\ub9ac\ucf00\uc774\uc158 \uae30\ubcf8 \uc124\uc815<\/h3>\n<pre><code>\nfrom fastapi import FastAPI\n\napp = FastAPI()\n\n@app.get(\"\/\")\ndef read_root():\n    return {\"Hello\": \"World\"}\n<\/code><\/pre>\n<p>\uc704 \ucf54\ub4dc\ub294 FastAPI \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uc758 \uae30\ubcf8 \uad6c\uc870\uc785\ub2c8\ub2e4. \uc774\uc81c \uc774 \uc571\uc5d0 OAuth2\uc640 JWT\ub97c \uad6c\ud604\ud560 \uac83\uc785\ub2c8\ub2e4.<\/p>\n<h3>3.2 \uc0ac\uc6a9\uc790 \ubaa8\ub378 \ubc0f \ub370\uc774\ud130\ubca0\uc774\uc2a4 \uc124\uc815<\/h3>\n<pre><code>\nfrom fastapi import Depends, FastAPI, HTTPException, status\nfrom fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm\nfrom pydantic import BaseModel\nfrom passlib.context import CryptContext\nfrom typing import Optional\nfrom datetime import datetime, timedelta\nimport jwt\n\n# \uc0ac\uc6a9\uc790 \ub370\uc774\ud130\ubca0\uc774\uc2a4 \uc2dc\ubbac\ub808\uc774\uc158\nfake_users_db = {\n    \"user@example.com\": {\n        \"username\": \"johndoe\",\n        \"full_name\": \"John Doe\",\n        \"email\": \"user@example.com\",\n        \"hashed_password\": \"$2b$12$KIXyhuOfCJcZawGBY5frXOCeC7g0BU6oq\/6kyPzA\/9eT4M1Og1Wiy\",  # \ube44\ubc00\ubc88\ud638: secret\n        \"disabled\": False,\n    }\n}\n\n# \uc720\ud6a8\uc131 \uac80\uc0ac \ubc0f \ud574\uc2f1 \uc554\ud638\ud654\nclass User(BaseModel):\n    username: str\n    full_name: Optional[str] = None\n    email: str\n    disabled: Optional[bool] = None\n\nclass UserInDB(User):\n    hashed_password: str\n\npwd_context = CryptContext(schemes=[\"bcrypt\"], deprecated=\"auto\")\n\ndef verify_password(plain_password, hashed_password):\n    return pwd_context.verify(plain_password, hashed_password)\n\ndef get_user(db, email: str):\n    if email in db:\n        user_data = db[email]\n        return UserInDB(**user_data)\n\n# OAuth2PasswordBearer \uc124\uc815\noauth2_scheme = OAuth2PasswordBearer(tokenUrl=\"token\")\n<\/code><\/pre>\n<h3>3.3 \uc0ac\uc6a9\uc790 \uc778\uc99d<\/h3>\n<pre><code>\ndef authenticate_user(db, email: str, password: str):\n    user = get_user(db, email)\n    if not user or not verify_password(password, user.hashed_password):\n        return False\n    return user\n\n# JWT \uc0dd\uc131\nSECRET_KEY = \"your_secret_key\"\nALGORITHM = \"HS256\"\nACCESS_TOKEN_EXPIRE_MINUTES = 30\n\ndef create_access_token(data: dict, expires_delta: Optional[timedelta] = None):\n    to_encode = data.copy()\n    if expires_delta:\n        expire = datetime.utcnow() + expires_delta\n    else:\n        expire = datetime.utcnow() + timedelta(minutes=15)\n    to_encode.update({\"exp\": expire})\n    encoded_jwt = jwt.encode(to_encode, SECRET_KEY, algorithm=ALGORITHM)\n    return encoded_jwt\n<\/code><\/pre>\n<h3>3.4 \ud1a0\ud070 \uacbd\ub85c \ucd94\uac00<\/h3>\n<pre><code>\n@app.post(\"\/token\")\nasync def login(form_data: OAuth2PasswordRequestForm = Depends()):\n    user = authenticate_user(fake_users_db, form_data.username, form_data.password)\n    if not user:\n        raise HTTPException(\n            status_code=status.HTTP_401_UNAUTHORIZED,\n            detail=\"\uc798\ubabb\ub41c \uc0ac\uc6a9\uc790 \uc774\ub984 \ub610\ub294 \ube44\ubc00\ubc88\ud638\",\n            headers={\"WWW-Authenticate\": \"Bearer\"},\n        )\n    access_token_expires = timedelta(minutes=ACCESS_TOKEN_EXPIRE_MINUTES)\n    access_token = create_access_token(\n        data={\"sub\": user.email}, expires_delta=access_token_expires\n    )\n    return {\"access_token\": access_token, \"token_type\": \"bearer\"}\n<\/code><\/pre>\n<h3>3.5 \ubcf4\ud638\ub41c \uacbd\ub85c \ucd94\uac00<\/h3>\n<pre><code>\n@app.get(\"\/users\/me\")\nasync def read_users_me(token: str = Depends(oauth2_scheme)):\n    credentials_exception = HTTPException(\n        status_code=status.HTTP_401_UNAUTHORIZED,\n        detail=\"\uc720\ud6a8\ud558\uc9c0 \uc54a\uc740 \ud1a0\ud070\",\n        headers={\"WWW-Authenticate\": \"Bearer\"},\n    )\n    try:\n        payload = jwt.decode(token, SECRET_KEY, algorithms=[ALGORITHM])\n        email: str = payload.get(\"sub\")\n        if email is None:\n            raise credentials_exception\n    except jwt.PyJWTError:\n        raise credentials_exception\n    user = get_user(fake_users_db, email)\n    if user is None:\n        raise credentials_exception\n    return user\n<\/code><\/pre>\n<h3>3.6 \uc560\ud50c\ub9ac\ucf00\uc774\uc158 \uc2e4\ud589<\/h3>\n<p>\ubaa8\ub4e0 \uc124\uc815\uc774 \uc644\ub8cc\ub418\uc5c8\uc73c\uba74 FastAPI \uc11c\ubc84\ub97c \uc2e4\ud589\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uc544\ub798 \uba85\ub839\uc5b4\ub97c \uc0ac\uc6a9\ud558\uc5ec \uc11c\ubc84\ub97c \uc2e4\ud589\ud558\uc2ed\uc2dc\uc624:<\/p>\n<pre><code>uvicorn main:app --reload<\/code><\/pre>\n<p>\uc774\uc81c \ube0c\ub77c\uc6b0\uc800\ub97c \ud1b5\ud574 <code>http:\/\/127.0.0.1:8000\/docs<\/code>\uc5d0 \uc811\uc18d\ud558\uc5ec API \uba85\uc138\ub97c \ud655\uc778\ud558\uace0, Swagger UI\ub97c \ud1b5\ud574 API\ub97c \ud14c\uc2a4\ud2b8\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n<h2>4. \uacb0\ub860<\/h2>\n<p>FastAPI\uc640 \ud568\uaed8 OAuth2 \ubc0f JWT\ub97c \uc0ac\uc6a9\ud558\uc5ec \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uc758 \uc778\uc99d \ubc0f \uad8c\ud55c \ubd80\uc5ec \uc2dc\uc2a4\ud15c\uc744 \uad6c\ud604\ud558\ub294 \ubc29\ubc95\uc744 \uc0b4\ud3b4\ubcf4\uc558\uc2b5\ub2c8\ub2e4. \uc774 \uac15\uc88c\ub97c \ud1b5\ud574 \uae30\ubcf8\uc801\uc778 \uc0ac\uc6a9\uc790 \uc778\uc99d \ub85c\uc9c1\uc744 \uc774\ud574\ud558\uace0 FastAPI\uc5d0\uc11c \uc5b4\ub5bb\uac8c \uad6c\ud604\ud560 \uc218 \uc788\ub294\uc9c0\ub97c \ubc30\uc6b8 \uc218 \uc788\uc5c8\uc2b5\ub2c8\ub2e4. \uc2e4\uc81c \ud658\uacbd\uc5d0\uc11c\ub294 \ubcf4\ub2e4 \ubcf5\uc7a1\ud55c \uc694\uad6c \uc0ac\ud56d\uc774 \uc788\uc744 \uc218 \uc788\uc73c\ubbc0\ub85c, \ucd94\uac00\uc801\uc778 \ubcf4\uc548 \uc870\uce58(\uc608: SSL\/TLS \uc554\ud638\ud654, \ube44\ubc00 \ud0a4 \uad00\ub9ac \ub4f1)\ub97c \uace0\ub824\ud558\ub294 \uac83\uc774 \uc911\uc694\ud569\ub2c8\ub2e4. FastAPI\ub97c \uc0ac\uc6a9\ud558\uc5ec \ub354 \uc548\uc804\ud558\uace0 \uac15\ub825\ud55c \ubc31\uc5d4\ub4dc \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uc744 \uad6c\ucd95\ud558\uc2dc\uae38 \ubc14\ub78d\ub2c8\ub2e4.<\/p>\n<p><\/body><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ud604\ub300 \uc6f9 \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uc740 \ub2e4\uc591\ud55c \ubcf4\uc548 \uc704\ud611\uc5d0 \ub178\ucd9c\ub418\uc5b4 \uc788\uc73c\uba70, \uc0ac\uc6a9\uc790 \uc778\uc99d \ubc0f \uad8c\ud55c \ubd80\uc5ec\ub294 \uc774\ub7ec\ud55c \uc704\ud611\uc73c\ub85c\ubd80\ud130 \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uc744 \ubcf4\ud638\ud558\ub294 \ub370 \ud544\uc218\uc801\uc785\ub2c8\ub2e4. \ubcf8 \ube14\ub85c\uadf8\uc5d0\uc11c\ub294 FastAPI\ub97c \uc0ac\uc6a9\ud558\uc5ec OAuth2 \ud504\ub85c\ud1a0\ucf5c\uacfc JWT(JSON Web Token)\ub97c \ud1b5\ud55c \uc778\uc99d \ubc0f \uad8c\ud55c \ubd80\uc5ec \uc2dc\uc2a4\ud15c\uc744 \uad6c\ucd95\ud558\ub294 \ubc29\ubc95\uc744 \uc790\uc138\ud788 \uc124\uba85\ud558\uaca0\uc2b5\ub2c8\ub2e4. \uc774 \uae00\uc744 \ud1b5\ud574 \ub3c5\uc790\ub4e4\uc740 FastAPI\ub85c \uc548\uc804\ud55c \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uc744 \uac1c\ubc1c\ud558\ub294 \ub370 \ud544\uc694\ud55c \uc9c0\uc2dd\uc744 \uc2b5\ub4dd\ud560 \uc218 \uc788\uc744 \uac83\uc785\ub2c8\ub2e4. 1. FastAPI &hellip; <a href=\"https:\/\/atmokpo.com\/w\/38471\/\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;FastAPI \uc11c\ubc84\uac1c\ubc1c, OAuth2\uc640 JWT\ub97c \uc0ac\uc6a9\ud55c \uc560\ud50c\ub9ac\ucf00\uc774\uc158 \ubcf4\uc548&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[183],"tags":[],"class_list":["post-38471","post","type-post","status-publish","format-standard","hentry","category-fastapi"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>FastAPI \uc11c\ubc84\uac1c\ubc1c, OAuth2\uc640 JWT\ub97c \uc0ac\uc6a9\ud55c \uc560\ud50c\ub9ac\ucf00\uc774\uc158 \ubcf4\uc548 - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/atmokpo.com\/w\/38471\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"FastAPI \uc11c\ubc84\uac1c\ubc1c, OAuth2\uc640 JWT\ub97c \uc0ac\uc6a9\ud55c \uc560\ud50c\ub9ac\ucf00\uc774\uc158 \ubcf4\uc548 - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"og:description\" content=\"\ud604\ub300 \uc6f9 \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uc740 \ub2e4\uc591\ud55c \ubcf4\uc548 \uc704\ud611\uc5d0 \ub178\ucd9c\ub418\uc5b4 \uc788\uc73c\uba70, \uc0ac\uc6a9\uc790 \uc778\uc99d \ubc0f \uad8c\ud55c \ubd80\uc5ec\ub294 \uc774\ub7ec\ud55c \uc704\ud611\uc73c\ub85c\ubd80\ud130 \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uc744 \ubcf4\ud638\ud558\ub294 \ub370 \ud544\uc218\uc801\uc785\ub2c8\ub2e4. \ubcf8 \ube14\ub85c\uadf8\uc5d0\uc11c\ub294 FastAPI\ub97c \uc0ac\uc6a9\ud558\uc5ec OAuth2 \ud504\ub85c\ud1a0\ucf5c\uacfc JWT(JSON Web Token)\ub97c \ud1b5\ud55c \uc778\uc99d \ubc0f \uad8c\ud55c \ubd80\uc5ec \uc2dc\uc2a4\ud15c\uc744 \uad6c\ucd95\ud558\ub294 \ubc29\ubc95\uc744 \uc790\uc138\ud788 \uc124\uba85\ud558\uaca0\uc2b5\ub2c8\ub2e4. \uc774 \uae00\uc744 \ud1b5\ud574 \ub3c5\uc790\ub4e4\uc740 FastAPI\ub85c \uc548\uc804\ud55c \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uc744 \uac1c\ubc1c\ud558\ub294 \ub370 \ud544\uc694\ud55c \uc9c0\uc2dd\uc744 \uc2b5\ub4dd\ud560 \uc218 \uc788\uc744 \uac83\uc785\ub2c8\ub2e4. 1. FastAPI &hellip; \ub354 \ubcf4\uae30 &quot;FastAPI \uc11c\ubc84\uac1c\ubc1c, OAuth2\uc640 JWT\ub97c \uc0ac\uc6a9\ud55c \uc560\ud50c\ub9ac\ucf00\uc774\uc158 \ubcf4\uc548&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/atmokpo.com\/w\/38471\/\" \/>\n<meta property=\"og:site_name\" content=\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-01T18:17:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-26T06:44:15+00:00\" \/>\n<meta name=\"author\" content=\"root\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:site\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:label1\" content=\"\uae00\uc4f4\uc774\" \/>\n\t<meta name=\"twitter:data1\" content=\"root\" \/>\n\t<meta name=\"twitter:label2\" content=\"\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04\" \/>\n\t<meta name=\"twitter:data2\" content=\"2\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/atmokpo.com\/w\/38471\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/38471\/\"},\"author\":{\"name\":\"root\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\"},\"headline\":\"FastAPI \uc11c\ubc84\uac1c\ubc1c, OAuth2\uc640 JWT\ub97c \uc0ac\uc6a9\ud55c \uc560\ud50c\ub9ac\ucf00\uc774\uc158 \ubcf4\uc548\",\"datePublished\":\"2024-11-01T18:17:20+00:00\",\"dateModified\":\"2024-11-26T06:44:15+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/atmokpo.com\/w\/38471\/\"},\"wordCount\":68,\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"articleSection\":[\"FastAPI\uc11c\ubc84\uac1c\ubc1c\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/atmokpo.com\/w\/38471\/\",\"url\":\"https:\/\/atmokpo.com\/w\/38471\/\",\"name\":\"FastAPI \uc11c\ubc84\uac1c\ubc1c, OAuth2\uc640 JWT\ub97c \uc0ac\uc6a9\ud55c \uc560\ud50c\ub9ac\ucf00\uc774\uc158 \ubcf4\uc548 - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#website\"},\"datePublished\":\"2024-11-01T18:17:20+00:00\",\"dateModified\":\"2024-11-26T06:44:15+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/atmokpo.com\/w\/38471\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/atmokpo.com\/w\/38471\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/atmokpo.com\/w\/38471\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\/\/atmokpo.com\/w\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"FastAPI \uc11c\ubc84\uac1c\ubc1c, OAuth2\uc640 JWT\ub97c \uc0ac\uc6a9\ud55c \uc560\ud50c\ub9ac\ucf00\uc774\uc158 \ubcf4\uc548\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/atmokpo.com\/w\/#website\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/atmokpo.com\/w\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"contentUrl\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"width\":400,\"height\":400,\"caption\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\"},\"image\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/bebubo4\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\",\"name\":\"root\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"caption\":\"root\"},\"sameAs\":[\"http:\/\/atmokpo.com\/w\"],\"url\":\"https:\/\/atmokpo.com\/w\/author\/root\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"FastAPI \uc11c\ubc84\uac1c\ubc1c, OAuth2\uc640 JWT\ub97c \uc0ac\uc6a9\ud55c \uc560\ud50c\ub9ac\ucf00\uc774\uc158 \ubcf4\uc548 - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/atmokpo.com\/w\/38471\/","og_locale":"ko_KR","og_type":"article","og_title":"FastAPI \uc11c\ubc84\uac1c\ubc1c, OAuth2\uc640 JWT\ub97c \uc0ac\uc6a9\ud55c \uc560\ud50c\ub9ac\ucf00\uc774\uc158 \ubcf4\uc548 - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","og_description":"\ud604\ub300 \uc6f9 \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uc740 \ub2e4\uc591\ud55c \ubcf4\uc548 \uc704\ud611\uc5d0 \ub178\ucd9c\ub418\uc5b4 \uc788\uc73c\uba70, \uc0ac\uc6a9\uc790 \uc778\uc99d \ubc0f \uad8c\ud55c \ubd80\uc5ec\ub294 \uc774\ub7ec\ud55c \uc704\ud611\uc73c\ub85c\ubd80\ud130 \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uc744 \ubcf4\ud638\ud558\ub294 \ub370 \ud544\uc218\uc801\uc785\ub2c8\ub2e4. \ubcf8 \ube14\ub85c\uadf8\uc5d0\uc11c\ub294 FastAPI\ub97c \uc0ac\uc6a9\ud558\uc5ec OAuth2 \ud504\ub85c\ud1a0\ucf5c\uacfc JWT(JSON Web Token)\ub97c \ud1b5\ud55c \uc778\uc99d \ubc0f \uad8c\ud55c \ubd80\uc5ec \uc2dc\uc2a4\ud15c\uc744 \uad6c\ucd95\ud558\ub294 \ubc29\ubc95\uc744 \uc790\uc138\ud788 \uc124\uba85\ud558\uaca0\uc2b5\ub2c8\ub2e4. \uc774 \uae00\uc744 \ud1b5\ud574 \ub3c5\uc790\ub4e4\uc740 FastAPI\ub85c \uc548\uc804\ud55c \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uc744 \uac1c\ubc1c\ud558\ub294 \ub370 \ud544\uc694\ud55c \uc9c0\uc2dd\uc744 \uc2b5\ub4dd\ud560 \uc218 \uc788\uc744 \uac83\uc785\ub2c8\ub2e4. 1. FastAPI &hellip; \ub354 \ubcf4\uae30 \"FastAPI \uc11c\ubc84\uac1c\ubc1c, OAuth2\uc640 JWT\ub97c \uc0ac\uc6a9\ud55c \uc560\ud50c\ub9ac\ucf00\uc774\uc158 \ubcf4\uc548\"","og_url":"https:\/\/atmokpo.com\/w\/38471\/","og_site_name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","article_published_time":"2024-11-01T18:17:20+00:00","article_modified_time":"2024-11-26T06:44:15+00:00","author":"root","twitter_card":"summary_large_image","twitter_creator":"@bebubo4","twitter_site":"@bebubo4","twitter_misc":{"\uae00\uc4f4\uc774":"root","\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04":"2\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/atmokpo.com\/w\/38471\/#article","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/38471\/"},"author":{"name":"root","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7"},"headline":"FastAPI \uc11c\ubc84\uac1c\ubc1c, OAuth2\uc640 JWT\ub97c \uc0ac\uc6a9\ud55c \uc560\ud50c\ub9ac\ucf00\uc774\uc158 \ubcf4\uc548","datePublished":"2024-11-01T18:17:20+00:00","dateModified":"2024-11-26T06:44:15+00:00","mainEntityOfPage":{"@id":"https:\/\/atmokpo.com\/w\/38471\/"},"wordCount":68,"publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"articleSection":["FastAPI\uc11c\ubc84\uac1c\ubc1c"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/atmokpo.com\/w\/38471\/","url":"https:\/\/atmokpo.com\/w\/38471\/","name":"FastAPI \uc11c\ubc84\uac1c\ubc1c, OAuth2\uc640 JWT\ub97c \uc0ac\uc6a9\ud55c \uc560\ud50c\ub9ac\ucf00\uc774\uc158 \ubcf4\uc548 - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/#website"},"datePublished":"2024-11-01T18:17:20+00:00","dateModified":"2024-11-26T06:44:15+00:00","breadcrumb":{"@id":"https:\/\/atmokpo.com\/w\/38471\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/atmokpo.com\/w\/38471\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/atmokpo.com\/w\/38471\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/atmokpo.com\/w\/en\/"},{"@type":"ListItem","position":2,"name":"FastAPI \uc11c\ubc84\uac1c\ubc1c, OAuth2\uc640 JWT\ub97c \uc0ac\uc6a9\ud55c \uc560\ud50c\ub9ac\ucf00\uc774\uc158 \ubcf4\uc548"}]},{"@type":"WebSite","@id":"https:\/\/atmokpo.com\/w\/#website","url":"https:\/\/atmokpo.com\/w\/","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","description":"","publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/atmokpo.com\/w\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Organization","@id":"https:\/\/atmokpo.com\/w\/#organization","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","url":"https:\/\/atmokpo.com\/w\/","logo":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/","url":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","contentUrl":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","width":400,"height":400,"caption":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8"},"image":{"@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/bebubo4"]},{"@type":"Person","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7","name":"root","image":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","caption":"root"},"sameAs":["http:\/\/atmokpo.com\/w"],"url":"https:\/\/atmokpo.com\/w\/author\/root\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/38471","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/comments?post=38471"}],"version-history":[{"count":1,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/38471\/revisions"}],"predecessor-version":[{"id":38472,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/38471\/revisions\/38472"}],"wp:attachment":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/media?parent=38471"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/categories?post=38471"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/tags?post=38471"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}