Move getAccessToken logic to the connection