Login using username and password

def login_oauth2(self, username, password, mfa_code=None):
        '''
        Login using username and password
        '''
        data = {
            "grant_type": "password",
            "scope": "internal",
            "client_id": CLIENT_ID,
            "expires_in": 86400,
            "password": password,
            "username": username
        }
        if mfa_code is not None:
            data['mfa_code'] = mfa_code
        url = "https://api.robinhood.com/oauth2/token/"
        res = self.post(url, payload=data, retry=False)

        if res is None:
            if mfa_code is None:
                msg = ("Client.login_oauth2(). Could not authenticate. Check "
                       + "username and password.")
                raise AuthenticationError(msg)
            else:
                msg = ("Client.login_oauth2(). Could not authenticate. Check" +
                       "username and password, and enter a valid MFA code.")
                raise AuthenticationError(msg)
        elif res.get('mfa_required') is True:
            msg = "Client.login_oauth2(). Couldn't authenticate. MFA required."
            raise AuthenticationError(msg)

        self.access_token = res["access_token"]
        self.refresh_token = res["refresh_token"]
        self.mfa_code = res["mfa_code"]
        self.scope = res["scope"]
        self.__set_account_info()
        return self.authenticated