Cookie will be refreshed each time a new request is sent

#Modification:
1. Minor coding style fix
2. Replaced cookie functions with single setCookie() to refresh auth
cookie each time a new request is sent.
3. Logging modified for logging  POST query in JSON format