Workaround for token mismatch error on server session timeout for config and http authentication types

I'm trying to use a mechanism similar to the one used by cookie authentication as a workaround to the token mismatch problem. Please see whether there are any security implications.