To improve the organization of this code it moves the JWT login checks to a separate handler and then fixes the bug (and a deprecation warning).