Removes a trailing \n character on the base64 token.
Adds required missing headers.