JWT
JSON Web Token
JWT is used for user authentication and is passed between the user and the server.
A JWT is a string composed of the header, payload, and signature
JWT.IO
JSON Web Tokens are an open, industry standard RFC 7519 method for representing claims securely between two parties.
jwt.io
인증 흐름 설명
클라이언트와 서버간의 인증토큰 흐름
회원가입 / 로그인시 토큰 발행
발행된 토큰을 클라이언트에서 저장하고
이를 인증 필요한 API 호출에 사용한다.
Flask에서 JWT 설치방법
$ pip install flask-jwt-extended
옵션 설명
https://flask-jwt-extended.readthedocs.io/en/latest/options/
Configuration Options — flask-jwt-extended 4.4.1 documentation
Configuration Options You can change many options for this extension works via Flask’s Configuration Handling. For example: app.config["OPTION_NAME"] = option_value General Options: JWT_TOKEN_LOCATION Where to look for a JWT when processing a request. Th
flask-jwt-extended.readthedocs.io
이 라이브러리는 다음 3개를 제공한다.
create_access_token()
@jwt_required(optional = False) : 무조건 토큰 필요, optional을 True로 하면 상관 없다는 뜻.
get_jwt_identity()
'BackEnd' 카테고리의 다른 글
| API - 로그인한 유저만 처리할 수 있는 API에 JWT 토큰 적용하는 방법 (0) | 2022.06.20 |
|---|---|
| API - 회원가입 / 로그인 API에서, 토큰 생성해서 처리하는 방법 (0) | 2022.06.20 |
| API - Python flask에서, Resource 클래스를 이용한 API 서버 개발 방법 (0) | 2022.06.19 |
| API - Python MySQL Connector를 이용해 delete 하는 방법 (0) | 2022.06.19 |
| API - Python MySQL Connector를 이용해 update 하는 방법 (0) | 2022.06.19 |