Get or create token

Rewrite of #5 
You shouldn't have try/catch here it will hide the header already written errors.