Hours of debugging later, the authentication mechanism is fully functional