def revoke_refresh_token(): """Revoke a refresh token, used mainly for logout --- delete: tags: - auth responses: 200: content: application/json: schema: type: object properties: message: type: string example: token revoked 400: description: bad request 401: description: unauthorized """ jti = get_raw_jwt()["jti"] user_identity = get_jwt_identity() revoke_token(jti, user_identity) return jsonify({"message": "token revoked"}), 200
def revoke_access_token(): """Revoke an access token --- delete: tags: - auth responses: 200: content: application/json: schema: type: object properties: message: type: string example: token revoked 400: description: bad request 401: description: unauthorized """ jti = get_raw_jwt()["jti"] user_identity = get_jwt_identity() revoke_token(jti, user_identity) return status_code.SUCCESS.d, 200
def revoke(token_id): user_identity = get_jwt_identity() revoke_token(token_id, user_identity) return jsonify({"message": "token revoked"}), 200