updated login function for new api-version