Refactor tryPostToken.