You can try getting the code in step one in the browser as well. This way it will cache the logged user in the browser and you won't need to sign in twice.
I hit a rock there on Android, as google doesn't like my redirect url, but maybe you will be lucky.