cozy

  • 홈
  • 태그
  • 방명록

2023/04/23 1

[FastAPI] Request에서 user 정보 얻기

해당 내용은 Startlette 공식 페이지와 스택오버플로우를 참고했다. Reqeust에 유저 정보 담기 FastAPI에서 Dependency를 이용해 token에서 유저 정보를 가져오기 위해서는 Request를 사용할 수 있다. async def get_current_user(req: Request): try: token = req.headers.get("authorization") secret_key = token_settings.secret_key algorithms = token_settings.algorithm verified_token = jwt.decode(token, secret_key, algorithms=algorithms) except jwt.ExpiredSignatureError: ..

FastAPI 2023.04.23
이전
1
다음
더보기
프로필사진

cozy

  • 분류 전체보기
    • Python
    • Django
    • FastAPI
    • Docker
    • Database

Tag

delete_cookie, corsheaders, List comprehensions, FastAPI, Pydantic, 일급객체, Til, Mixpanel, Django 초기 세팅, API Testing, set_cookie, django, refactoring, token authentication, nested function, wecode, drf, Python, 믹스패널, first class citizen,

최근글과 인기글

  • 최근글
  • 인기글

최근댓글

공지사항

페이스북 트위터 플러그인

  • Facebook
  • Twitter

Archives

Calendar

«   2023/04   »
일 월 화 수 목 금 토
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30

방문자수Total

  • Today :
  • Yesterday :

Copyright © AXZ Corp. All rights reserved.

티스토리툴바