def post(self): jti = get_raw_jwt()['jti'] try: revoked_token = RevokedToken(jti=jti) revoked_token.add() return {'message': 'logged out successfully'} except: return {'message': 'Something went wrong'}, 500
def post(self): jti = get_raw_jwt()['jti'] try: revoked_token = RevokedToken(jti=jti) revoked_token.add() return {'message': 'Refresh token has been revoked'} except: return {'message': 'Something went wrong'}, 500
def revoke_token(user: Journalist, auth_token: str) -> None: try: revoked_token = RevokedToken(token=auth_token, journalist_id=user.id) db.session.add(revoked_token) db.session.commit() except IntegrityError as e: db.session.rollback() if "UNIQUE constraint failed: revoked_tokens.token" not in str(e): raise e
def revoke_token(user: Journalist, auth_token: str) -> None: revoked_token = RevokedToken(token=auth_token, journalist_id=user.id) db.session.add(revoked_token) db.session.commit()
def revoke_token(user, auth_token): revoked_token = RevokedToken(token=auth_token, journalist_id=user.id) db.session.add(revoked_token) db.session.commit()
def check_token(decrypted_token): jti = decrypted_token['jti'] return RevokedToken.is_jti_blacklisted(jti)