Refactoring database usage.
Store auth key to config.