Move login to bottom and fix shard_id at authentication.