def authenticate_twofactor_credentials(self, user, request):
        user_addon = user.get_addon('twofactor')
        if user_addon and user_addon.is_confirmed:
            otp = request.META.get('HTTP_X_OSF_OTP')
            if otp is None:
                raise TwoFactorRequiredError()
            if not user_addon.verify_code(otp):
                raise exceptions.AuthenticationFailed(_('Invalid two-factor authentication OTP code.'))
Authenticate the user's two-factor one time password code.
dataset/ETHPy150Open CenterForOpenScience/osf.io/api/base/authentication/drf.py/OSFBasicAuthentication.authenticate_twofactor_credentials