perform api auth before launch and refactor libraries

before; the application would only create an authenticated api object upon the first request. here, it has been modified to create the api upon app initialization. therefore, if you try to start the app and `creds.yaml` contains invalid information or is missing, the app will not start.

additionally, the functions have been moved to a library, under `libs/lib.py`