def post(self): # 'logout' == 'invoke' == 'blacklist (only) token (not user_id)' # Note: each token has unique id of token call JWT_ID (jti) # All we have to do is blacklist jti jti = get_raw_jwt()['jti'] BLACKLIST.add(jti) return {'msg': 'Logout successfully.'}
def logout(self) -> dict: current_user = Users.query.filter_by(id=get_jwt_identity()).first() access_token = get_raw_jwt() token_blacklisted = { 'token': access_token['jti'], 'expires': BlacklistToken().transform_expires_to_date(access_token['exp']), 'user_id': access_token['identity'] } token = BlacklistToken(**token_blacklisted) token.add() return {'code': 200, 'message': f'Successfully logout user {current_user.email}'}
def post(self): jti = get_raw_jwt()['jti'] revoked_store.set(jti, 'true', ACCESS_EXPIRES) return {"message": "User logout successfully"}
def logout(): jti = get_raw_jwt()['jti'] revoke_token(jti) ret = {"msg": "Successfully logged out"} return jsonify(ret), 200
def post(self): jti = get_raw_jwt()['jti'] # jti is "JWT ID", a unique identifier for a JWT. user_id = get_jwt_identity() BLACKLIST.add(jti) return {"message": "User <id={}> successfully logged out.".format(user_id)}, 200
def post(self): jti = get_raw_jwt()['jti'] # Get the "JWT ID (JTI)" from the token BLACKLIST.add(jti) return resp_user_loggedout