Added optional config options to authentication process.
Fixed issue with POST header and added body.