Fixed error handling in getAccessToken and getRefreshToken cloud functions