Completed basic session management including renewal of the token. Only thing left is a cronjob that cleans up.